Skip to content

Instantly share code, notes, and snippets.

@simesy
Created February 9, 2021 11:31
Show Gist options
  • Save simesy/1f7963439e23cb365bf20e4156e01621 to your computer and use it in GitHub Desktop.
Save simesy/1f7963439e23cb365bf20e4156e01621 to your computer and use it in GitHub Desktop.
One liner to find something in your node output
# If you want to find node pages with a string on them. Replace FINDME
# This is pretty intensive it will load and render all nodes in your site.
drush ev '$st = \Drupal::entityTypeManager()->getStorage("node"); $b= \Drupal::entityTypeManager()->getViewBuilder("node"); $ns = $st->loadMultiple(); foreach ($ns as $node) { print "FINDME " . $node->id() . "\n"; $built = $b->view($node, "default"); $o = \Drupal::service("renderer")->renderRoot($built); var_dump($o); }' | grep FINDME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment