Commit 666ac23b authored by renatog's avatar renatog Committed by renatog
Browse files

Issue #3269783 by RenatoG: Implement an early return on service to preprocess...

Issue #3269783 by RenatoG: Implement an early return on service to preprocess service instead of long conditional code
parent 1f3d9fac
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -237,11 +237,18 @@ class BlockClassHelperService {
      return;
    }

    // If there is no block with this ID, skip.
    if (empty(Block::load($variables['elements']['#id']))) {
      return;
    }

    // Load the block by ID.
    $block = Block::load($variables['elements']['#id']);

    // Verify if the current block has Third Party Settings with classes.
    if ($block && $classes = $block->getThirdPartySetting('block_class', 'classes')) {
    $classes = $block->getThirdPartySetting('block_class', 'classes');

    if (!empty($classes)) {

      // Get all classes if exists.
      $classes_array = explode(' ', $classes);