Commit f2226100 authored by renatog's avatar renatog Committed by renatog
Browse files

Issue #3272855 by RenatoG: Implement a validation to avoid insert class inside...

Issue #3272855 by RenatoG: Implement a validation to avoid insert class inside of attribute fields since there is a class field
parent c2057f5a
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -794,6 +794,17 @@ class BlockClassHelperService {

      }

      // Validate class attribute.
      if ($attribute_key == 'class') {

        // Set a message informing that we can't use the class attribute.
        $form_state->setErrorByName('multiple_attributes][third_party_settings][block_class][attribute_' . $index . '][attribute_key_' . $index, $this->t("You can't use class. Use the field class instead"));

        // Return False on validation.
        return FALSE;

      }

      $attributes .= PHP_EOL . $attribute['attribute_key_' . $index] . '|' . $attribute['attribute_value_' . $index];

      // If there is a settings to allow only letters and numbers, validate it.