class NavigationTestBlock
Defines a dummy navigation block for testing purposes.
@internal
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
- class \Drupal\Core\Block\BlockBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\Core\Block\BlockPluginInterface, \Drupal\Core\Plugin\PluginWithFormsInterface, \Drupal\Core\Plugin\PreviewAwarePluginInterface, \Drupal\Core\Render\PreviewFallbackInterface, \Drupal\Core\Plugin\ContextAwarePluginInterface uses \Drupal\Core\Block\BlockPluginTrait, \Drupal\Core\Plugin\ContextAwarePluginTrait, \Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait
- class \Drupal\navigation_test_block\Plugin\Block\NavigationTestBlock extends \Drupal\Core\Block\BlockBase
- class \Drupal\Core\Block\BlockBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\Core\Block\BlockPluginInterface, \Drupal\Core\Plugin\PluginWithFormsInterface, \Drupal\Core\Plugin\PreviewAwarePluginInterface, \Drupal\Core\Render\PreviewFallbackInterface, \Drupal\Core\Plugin\ContextAwarePluginInterface uses \Drupal\Core\Block\BlockPluginTrait, \Drupal\Core\Plugin\ContextAwarePluginTrait, \Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
Expanded class hierarchy of NavigationTestBlock
File
-
core/
modules/ navigation/ tests/ navigation_test_block/ src/ Plugin/ Block/ NavigationTestBlock.php, line 17
Namespace
Drupal\navigation_test_block\Plugin\BlockView source
final class NavigationTestBlock extends BlockBase {
/**
* {@inheritdoc}
*/
public function build() : array {
$config = $this->configuration;
$build = [];
return $build + [
'#title' => $config['label'],
'#theme' => 'navigation_menu',
'#menu_name' => 'test',
'#items' => [
[
'title' => 'Test Navigation Block',
'class' => 'test-block',
'url' => Url::fromRoute('<front>'),
],
],
];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.