Created
January 16, 2018 14:39
-
-
Save adamfranco/4af29ce0dd3047df1532323019d6a291 to your computer and use it in GitHub Desktop.
Short script to bulk-update story nodes in Drupal. Execute with `drush8 php-script show_stories_in_newsroom.php`
This file contains hidden or 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
<?php | |
$query = \Drupal::entityQuery('node'); | |
$query->condition('type', 'story'); | |
$nids = $query->execute(); | |
echo "Updating " . count($nids) . " stories:\n"; | |
$nodes = node_load_multiple($nids); | |
foreach ($nodes as $node) { | |
$node->field_aggregate = TRUE; | |
$node->save(); | |
echo '.'; | |
} | |
echo "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment