Last active
December 4, 2015 14:46
-
-
Save rang501/6db8b6f59b40a8a535d5 to your computer and use it in GitHub Desktop.
Update node field programmatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$query = new EntityFieldQuery(); | |
$query->entityCondition('entity_type', 'node') | |
->entityCondition('bundle', 'article'); | |
$result = $query->execute(); | |
if (isset($result['node'])) { | |
$nodes = entity_load('node', array_keys($result['node'])); | |
foreach ($nodes as $node) { | |
$node->field_show_feedback[LANGUAGE_NONE][0]['value'] = 1; | |
$node->field_show_updated_date[LANGUAGE_NONE][0]['value'] = 1; | |
node_save($node); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment