Block.php

Same filename in this branch
  1. 11.x core/modules/views/src/Plugin/views/display/Block.php
  2. 11.x core/modules/block/src/Entity/Block.php
  3. 11.x core/modules/block/src/Plugin/migrate/source/Block.php
  4. 11.x core/lib/Drupal/Core/Block/Annotation/Block.php
Same filename and directory in other branches
  1. 9 core/modules/views/src/Plugin/views/display/Block.php
  2. 9 core/modules/block/src/Entity/Block.php
  3. 9 core/modules/block/src/Plugin/migrate/source/Block.php
  4. 9 core/lib/Drupal/Core/Block/Annotation/Block.php
  5. 8.9.x core/modules/views/src/Plugin/views/display/Block.php
  6. 8.9.x core/modules/block/src/Entity/Block.php
  7. 8.9.x core/modules/block/src/Plugin/migrate/source/Block.php
  8. 8.9.x core/lib/Drupal/Core/Block/Annotation/Block.php
  9. 10 core/modules/views/src/Plugin/views/display/Block.php
  10. 10 core/modules/block/src/Entity/Block.php
  11. 10 core/modules/block/src/Plugin/migrate/source/Block.php
  12. 10 core/lib/Drupal/Core/Block/Attribute/Block.php
  13. 10 core/lib/Drupal/Core/Block/Annotation/Block.php

Namespace

Drupal\Core\Block\Attribute

File

core/lib/Drupal/Core/Block/Attribute/Block.php

View source
<?php

namespace Drupal\Core\Block\Attribute;

use Drupal\Component\Plugin\Attribute\Plugin;
use Drupal\Core\StringTranslation\TranslatableMarkup;

/**
 * The Block attribute.
 */
class Block extends Plugin {
  
  /**
   * Constructs a Block attribute.
   *
   * @param string $id
   *   The plugin ID.
   * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $admin_label
   *   The administrative label of the block.
   * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $category
   *   (optional) The category in the admin UI where the block will be listed.
   * @param \Drupal\Core\Plugin\Context\ContextDefinitionInterface[] $context_definitions
   *   (optional) An array of context definitions describing the context used by
   *   the plugin. The array is keyed by context names.
   * @param class-string|null $deriver
   *   (optional) The deriver class.
   * @param array<string, string|false> $forms
   *   (optional) An array of form class names or FALSE, keyed by a string.
   */
  public function __construct(public readonly string $id, public readonly ?TranslatableMarkup $admin_label = NULL, public readonly ?TranslatableMarkup $category = NULL, public readonly array $context_definitions = [], public readonly ?string $deriver = NULL, public readonly array $forms = []) {
  }

}

Classes

Title Deprecated Summary
Block The Block attribute.

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