function theme_panels_flexible_admin in Panels 6.3
Same name and namespace in other branches
- 7.3 plugins/layouts/flexible/flexible.inc \theme_panels_flexible_admin()
Draw the flexible layout.
File
- plugins/
layouts/ flexible/ flexible.inc, line 395
Code
function theme_panels_flexible_admin($id, $content, $settings, $display, $layout, $handler) {
// We never draw stored flexible layouts in admin mode; they must be edited
// from the stored layout UI at that point.
if (!empty($layout['layout'])) {
return theme_panels_flexible($id, $content, $settings, $display, $layout, $handler);
}
panels_flexible_convert_settings($settings, $layout);
$renderer = panels_flexible_create_renderer(TRUE, $id, $content, $settings, $display, $layout, $handler);
$css = panels_flexible_render_css($renderer);
// For the administrative view, add CSS directly to head.
drupal_set_html_head("<style type=\"text/css\">\n{$css}</style>\n");
if (empty($display->editing_layout)) {
$output = '<input type="submit" id="panels-flexible-toggle-layout" value ="' . t('Show layout designer') . '">';
if (user_access('administer panels layouts')) {
$output .= '<input type="hidden" class="panels-flexible-reuse-layout-url" value="' . url($handler
->get_url('layout', 'reuse'), array(
'absolute' => TRUE,
)) . '">';
$output .= '<input type="submit" id="panels-flexible-reuse-layout" class="ctools-use-modal" value ="' . t('Reuse layout') . '">';
}
$output .= "<div class=\"panel-flexible " . $renderer->base['canvas'] . " clear-block panel-flexible-admin panel-flexible-no-edit-layout\" {$renderer->id_str}>\n";
}
else {
$output = "<div class=\"panel-flexible " . $renderer->base['canvas'] . " clear-block panel-flexible-admin panel-flexible-edit-layout\" {$renderer->id_str}>\n";
}
$output .= "<div class=\"panel-flexible-inside " . $renderer->base['canvas'] . "-inside \">\n";
$content = panels_flexible_render_items($renderer, $settings['items']['canvas']['children'], $renderer->base['row'] . '-canvas');
$output .= panels_flexible_render_item($renderer, $settings['items']['canvas'], $content, 'canvas', 0, 0, TRUE);
// Wrap the whole thing up nice and snug
$output .= "</div>\n</div>\n";
drupal_add_js($layout['path'] . '/flexible-admin.js');
drupal_add_js(array(
'flexible' => array(
'resize' => url($handler
->get_url('layout', 'resize'), array(
'absolute' => TRUE,
)),
),
), 'setting');
return $output;
}