function panels_theme in Panels 7.3
Same name and namespace in other branches
- 6.3 panels.module \panels_theme()
- 6.2 panels.module \panels_theme()
Implements hook_theme().
File
- ./
panels.module, line 47 - Core functionality for the Panels engine.
Code
function panels_theme() {
// Safety: go away if CTools is not at an appropriate version.
if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
return array();
}
$theme = array();
$theme['panels_layout_link'] = array(
'variables' => array(
'title' => NULL,
'id' => NULL,
'image' => NULL,
'link' => NULL,
'class' => NULL,
'options' => NULL,
),
);
$theme['panels_layout_icon'] = array(
'variables' => array(
'id' => NULL,
'image' => NULL,
'title' => NULL,
),
);
$theme['panels_pane'] = array(
'variables' => array(
'content' => array(),
'pane' => array(),
'display' => array(),
),
'path' => drupal_get_path('module', 'panels') . '/templates',
'template' => 'panels-pane',
);
$theme['panels_common_content_list'] = array(
'variables' => array(
'display' => NULL,
),
'file' => 'includes/common.inc',
);
$theme['panels_render_display_form'] = array(
'render element' => 'element',
);
$theme['panels_dashboard'] = array(
'variables' => array(),
'path' => drupal_get_path('module', 'panels') . '/templates',
'file' => '../includes/callbacks.inc',
'template' => 'panels-dashboard',
);
$theme['panels_dashboard_link'] = array(
'variables' => array(
'link' => array(),
),
'path' => drupal_get_path('module', 'panels') . '/templates',
'file' => '../includes/callbacks.inc',
'template' => 'panels-dashboard-link',
);
$theme['panels_dashboard_block'] = array(
'variables' => array(
'block' => array(),
),
'path' => drupal_get_path('module', 'panels') . '/templates',
'file' => '../includes/callbacks.inc',
'template' => 'panels-dashboard-block',
);
$theme['panels_add_content_modal'] = array(
'variables' => array(
'renderer' => NULL,
'categories' => array(),
'region' => NULL,
'category' => NULL,
'column_count' => 2,
),
'path' => drupal_get_path('module', 'panels') . '/templates',
'file' => '../includes/add-content.inc',
'template' => 'panels-add-content-modal',
);
$theme['panels_add_content_link'] = array(
'variables' => array(
'renderer' => NULL,
'region' => NULL,
'content_type' => NULL,
),
'path' => drupal_get_path('module', 'panels') . '/templates',
'file' => '../includes/add-content.inc',
'template' => 'panels-add-content-link',
);
// Register layout and style themes on behalf of all of these items.
ctools_include('plugins', 'panels');
// No need to worry about files; the plugin has to already be loaded for us
// to even know what the theme function is, so files will be auto included.
$layouts = panels_get_layouts();
foreach ($layouts as $name => $data) {
foreach (array(
'theme',
'admin theme',
) as $callback) {
if (!empty($data[$callback])) {
$theme[$data[$callback]] = array(
'variables' => array(
'css_id' => NULL,
'content' => NULL,
'settings' => NULL,
'display' => NULL,
'layout' => NULL,
'renderer' => NULL,
),
'path' => $data['path'],
'file' => $data['file'],
);
// If no theme function exists, assume template.
if (!function_exists("theme_{$data['theme']}")) {
$theme[$data[$callback]]['template'] = str_replace('_', '-', $data[$callback]);
// For preprocess.
$theme[$data[$callback]]['file'] = $data['file'];
}
}
}
}
$styles = panels_get_styles();
foreach ($styles as $name => $data) {
if (!empty($data['render pane'])) {
$theme[$data['render pane']] = array(
'variables' => array(
'content' => NULL,
'pane' => NULL,
'display' => NULL,
'style' => NULL,
'settings' => NULL,
),
'path' => $data['path'],
'file' => $data['file'],
);
}
if (!empty($data['render region'])) {
$theme[$data['render region']] = array(
'variables' => array(
'display' => NULL,
'owner_id' => NULL,
'panes' => NULL,
'settings' => NULL,
'region_id' => NULL,
'style' => NULL,
),
'path' => $data['path'],
'file' => $data['file'],
);
}
if (!empty($data['hook theme'])) {
if (is_array($data['hook theme'])) {
$theme += $data['hook theme'];
}
elseif (function_exists($data['hook theme'])) {
$data['hook theme']($theme, $data);
}
}
}
return $theme;
}