function panels_renderer_editor::ajax_select_content in Panels 7.3
Same name and namespace in other branches
- 6.3 plugins/display_renderers/panels_renderer_editor.class.php \panels_renderer_editor::ajax_select_content()
AJAX command to present a dialog with a list of available content.
1 call to panels_renderer_editor::ajax_select_content()
- panels_renderer_editor::ajax_add_pane in plugins/
display_renderers/ panels_renderer_editor.class.php - AJAX entry point to add a new pane.
File
- plugins/
display_renderers/ panels_renderer_editor.class.php, line 583 - Class file to control the main Panels editor.
Class
- panels_renderer_editor
- @file Class file to control the main Panels editor.
Code
function ajax_select_content($region = NULL, $category = NULL) {
if (!array_key_exists($region, $this->plugins['layout']['regions'])) {
ctools_modal_render(t('Error'), t('Invalid input'));
}
$title = t('Add content to !s', array(
'!s' => $this->plugins['layout']['regions'][$region],
));
$categories = $this
->get_categories($this->cache->content_types);
if (empty($categories)) {
$output = t('There are no content types you may add to this display.');
}
else {
$output = theme('panels_add_content_modal', array(
'renderer' => $this,
'categories' => $categories,
'category' => $category,
'region' => $region,
));
}
$this->commands[] = ctools_modal_command_display($title, $output);
// Give keybord focus to the first item in the category we just loaded.
if (!empty($category)) {
$this->commands[] = ajax_command_invoke(".panels-add-content-modal .panels-section-columns :focusable:first", 'focus');
}
}