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

Issue #3270910 by RenatoG: Implement the remove class button

parent 95b7e22d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -27,6 +27,16 @@
        $('.hidden-class-field').first().removeClass('hidden-class-field');
      });

      // On click to remove item, prevent default to stop going to another
      // page.
      $(".block-class-remove-item").on( "click", function(event) {

        // Prevent Default to stop the normal behavior and avoid going to
        // another page.
        event.preventDefault();

      });

      // Get the default case of Block Class.
      var default_case = 'standard';

+10 −1
Original line number Diff line number Diff line
@@ -400,12 +400,21 @@ class BlockClassHelperService {
        // Add another item button in the last field.
        $form['third_party_settings']['block_class']['add_another_item'] = [
          '#type' => 'button',
          '#value' => 'Add another item',
          '#value' => 'Add another class',
        ];

        // Add the class to identity the "add another item" button.
        $form['third_party_settings']['block_class']['add_another_item']['#attributes']['class'][] = 'block-class-add-another-item';

        // Add remove item button in the last field.
        $form['third_party_settings']['block_class']['remove_item'] = [
          '#type' => 'button',
          '#value' => 'Remove class',
        ];

        // Add the class to identity the "Remove item" button.
        $form['third_party_settings']['block_class']['remove_item']['#attributes']['class'][] = 'block-class-remove-item';

      }

      $form['third_party_settings']['block_class']['classes']['#attributes']['class'][] = 'block-class-class';