Commit 066fd970 authored by kishor kolekar's avatar kishor kolekar Committed by De Araujo, Renato [CONBR Non-J&J]
Browse files

Issue #3312035 by kishor_kolekar, RenatoG, trickfun, ericdsd: Warning: Trying...

Issue #3312035 by kishor_kolekar, RenatoG, trickfun, ericdsd: Warning: Trying to access array offset on value of type null in Drupal\block_class\Service\BlockClassHelperService->validateDynamicClasses()
parent ae908d92
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -931,7 +931,9 @@ class BlockClassHelperService {
    unset($third_party_settings['block_class']['remove_item']);

    // Clear empty values.
    $third_party_settings['block_class'] = !empty($third_party_settings['block_class']) ?? array_filter($third_party_settings['block_class']);
    if (!empty($third_party_settings['block_class'])) {
      $third_party_settings['block_class'] = array_filter($third_party_settings['block_class']);
    }

    // Merge with all third party settings.
    $all_third_party_settings = $form_state->getValue('third_party_settings');
@@ -958,9 +960,17 @@ class BlockClassHelperService {
      $classes_field = $third_party_settings['block_class'];

      // Unset values that aren't classes.
      if (isset($classes_field['attributes'])) {
        unset($classes_field['attributes']);
      }

      if (isset($classes_field['remove_item'])) {
        unset($classes_field['remove_item']);
      }

      if (isset($classes_field['add_another_item'])) {
        unset($classes_field['add_another_item']);
      }

      // Removed blank values.
      $classes_field = array_filter($classes_field);