views_plugin_display_default.inc 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_plugin_display_default.
  5. */
  6. /**
  7. * A plugin to handle defaults on a view.
  8. *
  9. * @ingroup views_display_plugins
  10. */
  11. class views_plugin_display_default extends views_plugin_display {
  12. /**
  13. * Determine if this display is the 'default' display which contains
  14. * fallback settings.
  15. */
  16. public function is_default_display() {
  17. return TRUE;
  18. }
  19. /**
  20. * The default execute handler fully renders the view.
  21. *
  22. * For the simplest use:
  23. * @code
  24. * $output = $view->execute_display('default', $args);
  25. * @endcode
  26. *
  27. * For more complex usages, a view can be partially built:
  28. *
  29. * @code
  30. * $view->set_arguments($args);
  31. * $view->build('default'); // Build the query.
  32. * $view->pre_execute(); // Pre-execute the query.
  33. * $view->execute(); // Run the query.
  34. * $output = $view->render(); // Render the view.
  35. * @endcode
  36. *
  37. * If short circuited at any point, look in $view->build_info for information
  38. * about the query. After execute, look in $view->result for the array of
  39. * objects returned from db_query.
  40. *
  41. * You can also do:
  42. *
  43. * @code
  44. * $view->set_arguments($args);
  45. * $output = $view->render('default'); // Render the view.
  46. * @endcode
  47. *
  48. * This illustrates that render is smart enough to call build and execute if
  49. * these items have not already been accomplished.
  50. *
  51. * Note that execute also must accomplish other tasks, such as setting page
  52. * titles, breadcrumbs, and generating exposed filter data if necessary.
  53. */
  54. public function execute() {
  55. return $this->view->render($this->display->id);
  56. }
  57. }