0

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

1
  • Hi ARGO, you seem to have 13 questions with zero accepted answers. Perhaps you could revisit your previous questions and accept some answers.
    – Chapabu
    Commented Nov 27, 2012 at 10:34

2 Answers 2

1

Views Bulk Operations, using the "Modify entity values" action.

1
  • Hi Bojan, How can I use this with rules, upon importing data using feeds?
    – ARGO
    Commented Nov 28, 2012 at 2:09
0

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);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.