function views_get_view

3.x views.module views_get_view($name, $reset = FALSE)
2.x views.module views_get_view($name, $reset = FALSE)

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

$name: The name of the view.

$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.

18 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 default glossary view.
ViewsUIWizardJumpMenuTestCase::testJumpMenus in tests/views_ui.test
Tests the jump menu style plugin.
ViewsViewTest::testDelete in tests/views_view.test

... 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 1557
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();
  }
}