Same name and namespace in other branches
  1. 5.x-1.x views.module \views_get_view()
  2. 6.x-3.x views.module \views_get_view()

Get a view from the database or from default views.

This function is just a static wrapper around views::load(). This function isn't called 'views_load()' primarily because it might get a view from the default views which aren't technically loaded from the database.

Parameters

string $name: The name of the view.

bool $reset: If TRUE, reset this entry in the load cache.

Return value

view A reference to the $view object. Use $reset if you're sure you want a fresh one.

19 calls to views_get_view()
ViewsAnalyzeTest::testAnalyzeBasic in tests/views_analyze.test
Tests that analyze works in general.
ViewsExposedFormTest::testRenameResetButton in tests/views_exposed_form.test
Tests, whether and how the reset button can be renamed.
ViewsGlossaryTestCase::testGlossaryView in tests/views_glossary.test
Tests the glossary feature.
ViewsUIWizardJumpMenuTestCase::testJumpMenus in tests/views_ui.test
Tests the jump menu style plugin.
ViewsViewTest::testDelete in tests/views_view.test
Test deleting a view.

... See full list

1 string reference to 'views_get_view'
views_ui_add_form in includes/admin.inc
Form builder for the "add new view" page.

File

./views.module, line 1736
Primarily Drupal hooks and global API functions to manipulate views.

Code

function views_get_view($name, $reset = FALSE) {
  if ($reset) {
    $cache =& drupal_static('ctools_export_load_object');
    if (isset($cache['views_view'][$name])) {
      unset($cache['views_view'][$name]);
    }
  }
  ctools_include('export');
  $view = ctools_export_crud_load('views_view', $name);
  if ($view) {
    $view
      ->update();
    return $view
      ->clone_view();
  }
}