function panels_ajax_bootstrap_edit_reuse in Panels Bootstrap Layout Builder 7.3
Same name and namespace in other branches
- 7 plugins/layouts/bootstrap/bootstrap.inc \panels_ajax_bootstrap_edit_reuse()
AJAX form to bring up the "reuse" modal.
1 string reference to 'panels_ajax_bootstrap_edit_reuse'
- bootstrap.inc in plugins/
layouts/ bootstrap/ bootstrap.inc
File
- plugins/
layouts/ bootstrap/ bootstrap.inc, line 1825
Code
function panels_ajax_bootstrap_edit_reuse($handler) {
$settings =& $handler->display->layout_settings;
panels_bootstrap_convert_settings($settings, $handler->plugins['layout']);
$form_state = array(
'display' => &$handler->display,
'settings' => &$settings,
'ajax' => TRUE,
'title' => t('Save this layout for reuse'),
);
$output = ctools_modal_form_wrapper('panels_bootstrap_reuse_form', $form_state);
if (!empty($form_state['executed'])) {
// Create the new layout.
ctools_include('export');
$layout = ctools_export_crud_new('panels_layout');
$layout->plugin = 'bootstrap';
$layout->name = $form_state['values']['name'];
$layout->admin_title = $form_state['values']['admin_title'];
$layout->admin_description = $form_state['values']['admin_description'];
$layout->category = $form_state['values']['category'];
$layout->settings = $handler->display->layout_settings;
// Save it.
ctools_export_crud_save('panels_layout', $layout);
if (empty($form_state['values']['keep'])) {
// Set the actual layout_settings to now use the newly minted layout:
$handler->display->layout = 'bootstrap:' . $layout->name;
$handler->display->layout_settings = array();
// Save our new state.
panels_edit_cache_set($handler->cache);
}
// Dismiss the modal.
$output[] = ctools_modal_command_dismiss();
}
$handler->commands = $output;
}