Commit bef6b76a authored by renatog's avatar renatog
Browse files

Issue #3272653 #3272749 by trickfun, RenatoG: Empty classes in config

parent 9800e2d8
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -646,6 +646,13 @@ class BlockClassHelperService {
      $third_party_settings['block_class']['attributes'] = $form_state->getValue('attributes')['third_party_settings']['block_class']['attributes'];
    }

    // Remove unused items.
    unset($third_party_settings['block_class']['add_another_item']);
    unset($third_party_settings['block_class']['remove_item']);

    // Clear empty values.
    $third_party_settings['block_class'] = array_filter($third_party_settings['block_class']);

    // Set the ThirdPartySettings with the default array.
    $form_state->setValue('third_party_settings', $third_party_settings);

@@ -706,6 +713,16 @@ class BlockClassHelperService {

      $third_party_settings['block_class']['classes'] = $classes;

      // Remove unused values from Third Party Settings.
      foreach ($third_party_settings['block_class'] as $key => $third_party_setting) {

        // If there is a classes_ we can remove.
        if (str_contains($key, 'classes_')) {
          unset($third_party_settings['block_class'][$key]);
        }

      }

      $form_state->setValue('third_party_settings', $third_party_settings);

    }
@@ -778,6 +795,9 @@ class BlockClassHelperService {

    $third_party_settings['block_class']['attributes'] = $attributes;

    // Remove the multiple_attributes attributes from ThirdPartySettings.
    unset($third_party_settings['block_class']['multiple_attributes']);

    $form_state->setValue('third_party_settings', $third_party_settings);

  }