1 layout.admin.inc | layout_settings_page($form, &$form_state) |
Administrative form for layout settings.
File
- core/
modules/ layout/ layout.admin.inc, line 3314 - Admin page callbacks for the Layout module.
Code
function layout_settings_page($form, &$form_state) {
$header = array(
'layout_template_info' => array('data' => t('Template')),
'type' => array(
'data' => t('Type'),
'sort' => 'desc',
'class' => array(RESPONSIVE_PRIORITY_LOW),
),
'operations' => t('Operations'),
);
backdrop_set_title(t('Layout templates'));
$excluded = config_get('layout.settings', 'excluded_templates');
$rows = array();
$options = array();
$default = array();
$form_state['hidden_templates'] = array();
$all_template_info = layout_get_layout_template_info(NULL, TRUE);
foreach ($all_template_info as $template_name => $template_info) {
// Build the default values list.
$is_default = FALSE;
if (!in_array($template_name, $excluded)) {
$is_default = $default[$template_name] = TRUE;
}
// Build the list of possible options, either enabled or not hidden.
if ($is_default || !$template_info['hidden']) {
$rows[$template_name] = array(
'layout_template_info' => theme('layout_template_info', array('template_info' => $template_info)),
'type' => !empty($template_info['flexible']) ? t('Flexible') : t('Standard'),
);
$rows[$template_name]['operations']['data'] = array(
'#type' => 'dropbutton',
'#links' => _layout_settings_get_group_operations($template_info, $is_default),
);
}
// For disabled and hidden templates, save the fact they are disabled.
elseif ($template_info['hidden']) {
$form_state['hidden_templates'][] = $template_name;
}
}
$form['#attached']['css'][] = backdrop_get_path('module', 'layout') . '/css/layout.admin.css';
$form['templates'] = array(
'#type' => 'tableselect',
'#js_select' => FALSE,
'#header' => $header,
'#options' => $rows,
'#empty' => t('There are no layout templates.'),
'#default_value' => $default,
'#attributes' => array('class' => array('layout-list')),
);
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
return $form;
}