function views_ui_cache_load

Specialized menu callback to load a view and check its locked status.

Parameters

string $name: The machine name of the view.

Return value

object The view object, with a "locked" property indicating whether or not someone else is already editing the view.

2 calls to views_ui_cache_load()
views_ui::load_item in plugins/export_ui/views_ui.class.php
Called by ctools_export_ui_load to load the item.
views_ui_edit_form_submit_preview in includes/admin.inc
Submit handler when Preview button is clicked.

File

./views_ui.module, line 318

Code

function views_ui_cache_load($name) {
    ctools_include('object-cache');
    views_include('view');
    $view = ctools_object_cache_get('view', $name);
    $original_view = views_get_view($name);
    if (empty($view)) {
        $view = $original_view;
        if (!empty($view)) {
            // Check to see if someone else is already editing this view.
            $view->locked = ctools_object_cache_test('view', $view->name);
            // Set a flag to indicate that this view is being edited.
            // This flag will be used e.g. to determine whether strings
            // should be localized.
            $view->editing = TRUE;
        }
    }
    else {
        // Keep disabled/enabled status real.
        if ($original_view) {
            $view->disabled = !empty($original_view->disabled);
        }
    }
    if (empty($view)) {
        return FALSE;
    }
    else {
        return $view;
    }
}