Guest User

Untitled

a guest
May 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. <?php
  2.  
  3. $view = Views::getView('view_id'); // view_id - refers the machiene name of the view
  4. $view->setDisplay('display_id'); // display_id - refered to the current view display which you want to render the result from.
  5. $view->setArguments($args); // Where $args is the array contains the filter value for uid.
  6. $view->execute();
  7.  
  8. foreach($view->result as $row){
  9. dpm($row->_entity->get('Custom text')->getValue());
  10. }
  11.  
  12. // or
  13. $view_result = \Drupal::service('renderer')->render($view->render());
Add Comment
Please, Sign In to add comment