ShortcutTestHooks.php

Same filename and directory in other branches
  1. 11.x core/modules/shortcut/tests/modules/shortcut_test/src/Hook/ShortcutTestHooks.php

Namespace

Drupal\shortcut_test\Hook

File

core/modules/shortcut/tests/modules/shortcut_test/src/Hook/ShortcutTestHooks.php

View source
<?php

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

use Drupal\Core\Hook\Attribute\Hook;
use Drupal\Core\State\StateInterface;

/**
 * Hooks implementations for shortcut_test module.
 */
class ShortcutTestHooks {
  
  /**
   * ShortcutTestHooks constructor.
   *
   * @param \Drupal\Core\State\StateInterface $state
   *   The state service.
   */
  public function __construct(protected StateInterface $state) {
  }
  
  /**
   * Implements hook_block_alter().
   *
   * @see \Drupal\Tests\shortcut\Functional\testNavigationSafeBlockDefinition()
   */
  public function blockAlter(&$definitions) : void {
    if ($this->state
      ->get('navigation_safe_alter')) {
      $definitions['navigation_shortcuts']['allow_in_navigation'] = FALSE;
    }
  }

}

Classes

Title Deprecated Summary
ShortcutTestHooks Hooks implementations for shortcut_test module.

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