function panels_flexible_reuse_form_validate in Panels 7.3
Same name and namespace in other branches
- 6.3 plugins/layouts/flexible/flexible.inc \panels_flexible_reuse_form_validate()
File
- plugins/
layouts/ flexible/ flexible.inc, line 1816 - Flexible layout plugin.
Code
function panels_flexible_reuse_form_validate(&$form, &$form_state) {
if (empty($form_state['values']['name'])) {
form_error($form['name'], t('You must choose a machine name.'));
}
ctools_include('export');
$test = ctools_export_crud_load('panels_layout', $form_state['values']['name']);
if ($test) {
form_error($form['name'], t('That name is used by another layout: @layout', array(
'@layout' => $test->admin_title,
)));
}
// Ensure name fits the rules:
if (preg_match('/[^a-zA-Z0-9_]/', $form_state['values']['name'])) {
form_error($form['name'], t('Name must be alphanumeric or underscores only.'));
}
}