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

Issue #3274692 by RenatoG: Attribute allowing equal sign on key and value

parent 0a668b3a
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -902,8 +902,30 @@ class BlockClassHelperService {

      $attribute_key = $attribute['attribute_key_' . $index];

      // Verify if there is a equal sign on attribute key.
      $equal_sign_found = strpos($attribute_key, '=');

      if ($equal_sign_found !== FALSE) {

        $form_state->setErrorByName('multiple_attributes][third_party_settings][block_class][attribute_' . $index . '][attribute_key_' . $index, $this->t("Ins't necessary add = sign. You can use the key and value fields"));

        return FALSE;

      }

      $attribute_value = $attribute['attribute_value_' . $index];

      // Verify if there is a equal sign on attribute value.
      $equal_sign_found = strpos($attribute_value, '=');

      if ($equal_sign_found !== FALSE) {

        $form_state->setErrorByName('multiple_attributes][third_party_settings][block_class][attribute_' . $index . '][attribute_value_' . $index, $this->t("Ins't necessary add = sign. You can use the key and value fields"));

        return FALSE;

      }

      // Search by duplicated attributes.
      $attribute_already_exists = array_search($attribute_key, $attribute_keys);