You are here

function panels_views_load in Panels 5.2

Load a view pane from the database.

5 calls to panels_views_load()
panels_views_delete_confirm in panels_views/panels_views.module
Provide a form to confirm deletion of a view pane.
panels_views_edit in panels_views/panels_views.module
Provide the pane edit dialog.
panels_views_edit_view in panels_views/panels_views.module
Page callback to edit a view pane.
panels_views_export_view in panels_views/panels_views.module
Page callback to export a view pane.
panels_views_render in panels_views/panels_views.module
Render a view as a pane.

File

panels_views/panels_views.module, line 1357
panels_views.module

Code

function panels_views_load($name) {
  static $panel_views = array();
  if (array_key_exists($name, $panel_views)) {
    return $panel_views[$name];
  }
  $pv = db_fetch_object(db_query("SELECT * FROM {panels_views} WHERE name = '%s'", $name));
  if (empty($pv)) {
    $defaults = panels_views_default_panels();
    if (isset($defaults[$name])) {
      $pv = $defaults[$name];
      $status = variable_get('panels_views_defaults', array());

      // Determine if default panel is enabled or disabled.
      if (isset($status[$pv->name])) {
        $pv->disabled = $status[$pv->name];
      }
      $panel_views[$name] = $pv;
      return $pv;
    }
    $panel_views[$name] = NULL;
    return;
  }
  $names = panels_views_pane_fields();
  foreach ($names as $key => $data) {
    if (!empty($data['serialize'])) {
      $pv->{$key} = unserialize($pv->{$key});
    }
  }
  $panel_views[$name] = $pv;
  return $panel_views[$name];
}