function PanelizerEntityDefault::page_overview in Panelizer 7.3
Switched page callback to give the overview page
File
- plugins/
entity/ PanelizerEntityDefault.class.php, line 2173 - Base class for the Panelizer Entity plugin.
Class
- PanelizerEntityDefault
- Base class for the Panelizer Entity plugin.
Code
function page_overview($js, $input, $entity) {
$header = array(
t('View mode'),
t('Status'),
t('Operations'),
);
list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);
$rows = array();
$base_url = $this
->entity_base_url($entity);
foreach ($this->plugin['view modes'] as $view_mode => $view_mode_info) {
if (!$this
->is_panelized($bundle . '.' . $view_mode)) {
continue;
}
$row = array();
$row[] = $view_mode_info['label'];
$panelized = TRUE;
if (!empty($entity->panelizer[$view_mode]->name)) {
ctools_include('export');
$panelizer = ctools_export_crud_load('panelizer_defaults', $entity->panelizer[$view_mode]->name);
$status = !empty($panelizer->title) ? check_plain($panelizer->title) : t('Default');
}
else {
if (!empty($entity->panelizer[$view_mode]->did)) {
$status = t('Custom');
}
else {
$status = t('Not panelized');
$panelized = FALSE;
}
}
$row[] = $status;
if ($panelized) {
$links_array = array();
foreach (panelizer_operations() as $path => $operation) {
if ($this
->panelizer_access($path, $entity, $view_mode)) {
$links_array[$path] = array(
'title' => $operation['link title'],
'href' => $base_url . '/' . $view_mode . '/' . $path,
);
}
}
if ($status == t('Custom')) {
$links_array['reset'] = array(
'title' => t('reset'),
'href' => $base_url . '/' . $view_mode . '/reset',
);
}
}
else {
$links_array = array(
'panelize' => array(
'title' => t('panelize'),
'href' => $base_url . '/' . $view_mode,
),
);
}
// Allow applications to add additional panelizer tabs.
$context = array(
'entity' => $entity,
'view_mode' => $view_mode,
'status' => $status,
'panelized' => $panelized,
);
drupal_alter('panelizer_overview_links', $links_array, $this->entity_type, $context);
$links = theme('links', array(
'links' => $links_array,
'attributes' => array(
'class' => array(
'links',
'inline',
),
),
));
$row[] = $links;
$rows[] = $row;
}
return array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
'#prefix' => '<p>' . t('Changes made here will override the default (Panelizer) displays and will only affect this @entity.', array(
'@entity' => $this->entity_type,
)) . "</p>\n",
);
}