function panels_bootstrap_render_item_links in Panels Bootstrap Layout Builder 7.3
Same name and namespace in other branches
- 7 plugins/layouts/bootstrap/bootstrap.inc \panels_bootstrap_render_item_links()
Render the dropdown links for an item.
4 calls to panels_bootstrap_render_item_links()
- panels_ajax_bootstrap_edit_add in plugins/
layouts/ bootstrap/ bootstrap.inc - AJAX responder to add a new row, column or region to a bootstrap layout.
- panels_ajax_bootstrap_edit_remove in plugins/
layouts/ bootstrap/ bootstrap.inc - AJAX responder to remove an existing row, column or region from a bootstrap layout.
- panels_ajax_bootstrap_edit_settings in plugins/
layouts/ bootstrap/ bootstrap.inc - AJAX responder to edit bootstrap settings for an item.
- panels_bootstrap_render_item in plugins/
layouts/ bootstrap/ bootstrap.inc - Render a column in the bootstrap layout.
File
- plugins/
layouts/ bootstrap/ bootstrap.inc, line 568
Code
function panels_bootstrap_render_item_links($renderer, $id, $item) {
$links = array();
$remove = '';
$add = '';
switch ($item['type']) {
case 'container':
if ($id == 'canvas') {
$title = t('Canvas');
$settings = t('Canvas settings');
}
else {
$title = t('Container');
$settings = t('Container settings');
}
if (empty($item['children'])) {
if ($id != 'canvas') {
$remove = t('Remove container');
}
switch ($item['contains']) {
case 'region':
$add = t('Add region');
break;
case 'row':
$add = t('Add row');
break;
case 'container':
$add = t('Add container');
break;
}
}
else {
switch ($item['contains']) {
case 'region':
$add = t('Add region to top');
$add2 = t('Add region to bottom');
break;
case 'row':
$add = t('Add row to top');
$add2 = t('Add row to bottom');
break;
case 'container':
$add = t('Add container to top');
$add2 = t('Add container to bottom');
}
}
break;
case 'row':
$title = t('Row');
$settings = t('Row settings');
if (empty($item['children'])) {
$remove = t('Remove row');
$add = t('Add column');
}
else {
$add = t('Add column to left');
$add2 = t('Add column to right');
break;
}
break;
case 'column':
$title = t('Column');
$settings = t('Column settings');
if (empty($item['children'])) {
$remove = t('Remove column');
switch ($item['contains']) {
case 'container':
$add = t('Add container');
break;
case 'row':
$add = t('Add row');
break;
case 'region':
$add = t('Add region');
break;
}
}
else {
switch ($item['contains']) {
case 'container':
$add = t('Add container to top');
$add2 = t('Add container to bottom');
break;
case 'row':
$add = t('Add row to top');
$add2 = t('Add row to bottom');
break;
case 'region':
$add = t('Add region to top');
$add2 = t('Add region to bottom');
break;
}
}
break;
case 'region':
$title = t('Region');
$settings = t('Region settings');
$remove = t('Remove region');
break;
default:
break;
}
if (!empty($settings)) {
$links[] = array(
'title' => $settings,
'href' => $renderer->handler
->get_url('layout', 'settings', $id),
'attributes' => array(
'class' => array(
'ctools-use-modal',
),
),
);
}
if ($add) {
$links[] = array(
'title' => $add,
'href' => $renderer->handler
->get_url('layout', 'add', $id),
'attributes' => array(
'class' => array(
'ctools-use-modal',
),
),
);
}
if (isset($add2)) {
$links[] = array(
'title' => $add2,
'href' => $renderer->handler
->get_url('layout', 'add', $id, 'right'),
'attributes' => array(
'class' => array(
'ctools-use-modal',
),
),
);
}
if ($remove) {
$links[] = array(
'title' => $remove,
'href' => $renderer->handler
->get_url('layout', 'remove', $id),
'attributes' => array(
'class' => array(
'use-ajax',
),
),
);
}
return theme('ctools_dropdown', array(
'title' => $title,
'links' => $links,
'class' => 'bootstrap-layout-only bootstrap-links bootstrap-title bootstrap-links-' . $id,
));
}