public function HtaccessDisplayForm::htaccess_admin_settings_generate_validate in Htaccess 8.2
Admin htaccess generate validation handler.
File
- src/
Form/ HtaccessDisplayForm.php, line 128 - Administration pages.
Class
- HtaccessDisplayForm
- Defines a form to configure RSVP List module settings
Namespace
Drupal\htaccess\FormCode
public function htaccess_admin_settings_generate_validate($form, &$form_state) {
$profile_name = $form_state['values']['htaccess_settings_generate_name'];
if (preg_match('/[^a-z0-9]/', $profile_name)) {
form_error($form, t('The name of the profile must be lowercase and without any special character.'));
}
// The name of the profile must be unique
$htaccess_name = db_select('htaccess', 'h')
->fields('h')
->condition('name', $profile_name, '=')
->execute()
->fetchAssoc();
if ($htaccess_name) {
form_error($form, t('The profile @profile already exists.', array(
'@profile' => $profile_name,
)));
}
}