Skip to content

Instantly share code, notes, and snippets.

@apperceive
Last active November 5, 2015 22:23
Show Gist options
  • Save apperceive/38109072a1cf656a533d to your computer and use it in GitHub Desktop.
Save apperceive/38109072a1cf656a533d to your computer and use it in GitHub Desktop.
Some drupal drush commands used as experiments aimed at creating pipes for glup? I dunno. We'll see.
# simple drupal calls via drush
drush @d7Test ev '$a = node_type_get_types(); while (list($k,$v) = each($a)) {echo "\"$k\",\"$v->name\",\"$v->description\"\n\n";}'
drush @d7Test ev '$a = system_get_info("theme"); while (list($k,$v) = each($a)) {echo "\"$k\",\"$v->name\",\"$v->description\"\n\n";}'
#unions might be nice?
drush @d7Test ev '$a = system_get_info("module"); while (list($k,$v) = each($a)) {echo "\"$k\",\"$v->name\",\"$v->description\"\n\n";}'
drush @slndev ev '$a = array_keys(system_get_info("theme")); while (list($k,$v) = each($a)) {echo "$k\n";}'
# dump a return value
drush @slndev ev '$a = system_get_info("theme"); while (list($k,$v) = each($a)) {echo var_export($a, 1) . "\n\n";}'
# display first item in array
drush @slndev ev '$a = array_shift(system_get_info("theme")); {echo var_export($a,1) . "\n";}'
#display top level keys based on first item in array
drush @slndev ev '$a = array_keys(array_shift(system_get_info("theme"))); while (list($k,$v) = each($a)) {echo "$v\n";}'
# how check for null before array_keys call? - this throws an error
drush @slndev ev '$a = array_keys(array_shift(system_get_info("modules"))); while (list($k,$v) = each($a)) {echo "$v\n";}'
# active themes
drush @slndev ev '$a = array_shift(system_get_info("theme")); {echo $a["name"] . "\n\n";}'
# show theme regions
drush @slndev ev '$a = system_get_info("theme"); while (list($k,$v) = each($a)) {echo $k . ": " . var_export($v["regions"], 1) . "\n\n";}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment