What would be the best approach (preferably with GUI) to delete the content of certain fields from certain content types.
I am thinking of using rules but I cant configure to do it.
Ny ideas? Thanks
What would be the best approach (preferably with GUI) to delete the content of certain fields from certain content types.
I am thinking of using rules but I cant configure to do it.
Ny ideas? Thanks
Views Bulk Operations, using the "Modify entity values" action.
You can easily do this with a little piece of code - just use field_attach_update () function.
Here is very good article "Saving node's fields without saving the node itself" that will help you.
Your code can be as follow:
$nids = db_query(
'SELECT nid FROM {node} WHERE type in (:node_types)',
array(
':node_types' => array('TYPE1', 'TYPE2'),
)
)->fetchCol();
$nodes = node_load_multiple($nids);
foreach ($nodes as $node) {
$node->field_fieldname[LANGUAGE_NONE][0]['value'] = 'some value';
field_attach_presave('node', $node);
field_attach_update('node', $node);
}