Skip to content

Instantly share code, notes, and snippets.

@Unifex
Created June 1, 2016 22:08
Show Gist options
  • Save Unifex/bd5f650b604d3695e94746be62b6e3aa to your computer and use it in GitHub Desktop.
Save Unifex/bd5f650b604d3695e94746be62b6e3aa to your computer and use it in GitHub Desktop.
I do a lot of prototyping on the command line with drush. This allowed me to test switching content types. It's very bare bones but it's a good place to start.
drush ev '
$query = new EntityFieldQuery;
print_r($query);
$result = $query->entityCondition("entity_type", "node")
->propertyCondition("type", "morning_message")
->execute();
print_r($result);
foreach ($result['node'] as $row) {
print_r($row);
$node = node_load($row->nid);
print_r($node);
$node->type = "news";
node_save($node);
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment