Last active
June 11, 2018 02:50
-
-
Save algotrader-dotcom/880f84a97aad1e858379bad5e464d9d4 to your computer and use it in GitHub Desktop.
Drupal 8 : Render view programmatically
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 | |
| $id = 'a'; | |
| $view = \Drupal\views\Views::getView('glossary'); | |
| $view->setDisplay('default'); | |
| $view->setArguments([$id]); | |
| $view->execute(); | |
| $results = $view->result; | |
| foreach($results as $result){ | |
| $nid = $result->nid; | |
| $node_storage = \Drupal::entityTypeManager()->getStorage('node'); | |
| $node = $node_storage->load($nid); | |
| print $node->title->value."\n"; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment