BlockContentThemeSuggestionsTestThemeHooks.php

Namespace

Drupal\block_content_theme_suggestions_test\Hook

File

core/modules/block_content/tests/modules/block_content_theme_suggestions_test/src/Hook/BlockContentThemeSuggestionsTestThemeHooks.php

View source
<?php

declare (strict_types=1);
namespace Drupal\block_content_theme_suggestions_test\Hook;

use Drupal\block_content\BlockContentInterface;
use Drupal\Core\Hook\Attribute\Hook;

/**
 * Hook implementations for block_content_theme_suggestions_test.
 */
class BlockContentThemeSuggestionsTestThemeHooks {
  
  /**
   * Implements hook_preprocess_block().
   */
  public function preprocessBlock(&$variables) : void {
    $block_content = $variables['elements']['content']['#block_content'] ?? NULL;
    if ($block_content instanceof BlockContentInterface) {
      $variables['label'] = $block_content->label();
    }
  }

}

Classes

Title Deprecated Summary
BlockContentThemeSuggestionsTestThemeHooks Hook implementations for block_content_theme_suggestions_test.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.