Commit 14415d74 authored by renatog's avatar renatog Committed by renatog
Browse files

Issue #3272360 by RenatoG: Add the buttons to add and remove attributes...

Issue #3272360 by RenatoG: Add the buttons to add and remove attributes dynamically in the attributes textfields
parent 082d4350
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -6,6 +6,19 @@
  display: none;
}

.hidden-attribute-field {
  display: none;
}

/* Attributes that will be managed dynamically using JS */
.multiple-textfield-attribute {
  display: none;
}

#edit-attributes-add-another-attribute {
  display: none;
}

#edit-attributes-remove-attribute {
  display: none;
}
+14 −0
Original line number Diff line number Diff line
@@ -548,6 +548,20 @@ class BlockClassHelperService {

        }

        $form['attributes']['add_another_attribute'] = [
          '#type' => 'button',
          '#value' => 'Add another attribute',
        ];

        $form['attributes']['add_another_attribute']['#attributes']['class'][] = 'block-class-add-another-attribute';

        $form['attributes']['remove_attribute'] = [
          '#type' => 'button',
          '#value' => 'Remove attribute',
        ];

        $form['attributes']['remove_attribute']['#attributes']['class'][] = 'block-class-remove-attribute';

        // Get the field type if exists.
        if (!empty($config->get('field_type_attributes'))) {
          $field_type_attributes = $config->get('field_type_attributes');