Skip to content
Snippets Groups Projects
Commit bc44057d authored by renatog's avatar renatog Committed by renatog
Browse files

Issue #3270563 by RenatoG: Bulk operation for add class isn't validation the...

Issue #3270563 by RenatoG: Bulk operation for add class isn't validation the special chars that was configured in the settings page
parent 2f418b60
No related branches found
No related tags found
10 merge requests!62Issue #3272848 by RenatoG: When the error appear the field is hidden and the...,!59Issue #3497768: Click JavaScript to close details causes modals to scroll unnecessarily,!35Issue #3366420: \Drupal calls should be avoided in classes,!34Issue #3366420: \Drupal calls should be avoided in classes,!29Issue #3272632 by RenatoG: Add a logic to block and disable the remove item if...,!28Issue #3272632 by RenatoG: Add a logic to block and disable the remove item if...,!23Issue #3272632 by RenatoG: Add a logic to block and disable the remove item if...,!22Issue #3272632 by RenatoG: Add a logic to block and disable the remove item if...,!20Issue #3272632 by RenatoG: Add a logic to block and disable the remove item if...,!7Issue #3320529 by justcaldwell: block_classes_stored setting only retains classes from most recently saved block
......@@ -291,6 +291,39 @@ class BlockClassBulkOperationsForm extends ConfigFormBase {
}
/**
* Validate the form.
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
if ($form_state->getValue('operation') != 'insert') {
return FALSE;
}
if (empty($form_state->getValue('classes_to_be_added'))) {
return;
}
// Get config object.
$config = $this->configFactory->getEditable('block_class.settings');
// If there is a settings to allow only letters and numbers, validate this.
if (empty($config->get('allow_only_letters_and_numbers'))) {
return FALSE;
}
$classes_to_be_added = $form_state->getValue('classes_to_be_added');
if (preg_match('/[\'^£$%&*()}{@#~?><>,|=+¬]/', $classes_to_be_added)) {
$form_state->setErrorByName('classes_to_be_added', $this->t("In class is allowed only letters, numbers, hyphen and underline"));
return FALSE;
}
}
/**
* {@inheritdoc}
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment