Commit 90313f1a authored by renatog's avatar renatog Committed by De Araujo, Renato [CONBR Non-J&J]
Browse files

Issue #3320820 by RenatoG, justcaldwell: Fatal error if one attribute value is blank

parent 3e777085
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1093,6 +1093,14 @@ class BlockClassHelperService {

      }

      // Validate if key and value are populated.
      if (empty($attribute_key) || empty($attribute_value)) {

        $form_state->setErrorByName('multiple_attributes][third_party_settings][block_class][attribute_' . $index . '][attribute_key_' . $index, $this->t('To apply attribute is necessary put "key" and "value"'));

        return FALSE;
      }

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

@@ -1293,6 +1301,7 @@ class BlockClassHelperService {
      unset($multiple_items['add_another_item']);
      unset($multiple_items['remove_item']);
      unset($multiple_items['attributes']);
      unset($multiple_items['multiple_attributes']);
      unset($multiple_items['classes']);

      // Run a foreach in all items.