class Broken in Drupal 9
Same name in this branch
- 9 core/lib/Drupal/Core/Block/Plugin/Block/Broken.php \Drupal\Core\Block\Plugin\Block\Broken
- 9 core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/Broken.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\Broken
- 9 core/modules/views/src/Plugin/views/area/Broken.php \Drupal\views\Plugin\views\area\Broken
- 9 core/modules/views/src/Plugin/views/relationship/Broken.php \Drupal\views\Plugin\views\relationship\Broken
- 9 core/modules/views/src/Plugin/views/filter/Broken.php \Drupal\views\Plugin\views\filter\Broken
- 9 core/modules/views/src/Plugin/views/sort/Broken.php \Drupal\views\Plugin\views\sort\Broken
- 9 core/modules/views/src/Plugin/views/argument/Broken.php \Drupal\views\Plugin\views\argument\Broken
- 9 core/modules/views/src/Plugin/views/field/Broken.php \Drupal\views\Plugin\views\field\Broken
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Block/Plugin/Block/Broken.php \Drupal\Core\Block\Plugin\Block\Broken
Defines a fallback plugin for missing block plugins.
Plugin annotation
@Block(
id = "broken",
admin_label = @Translation("Broken/Missing"),
category = @Translation("Block"),
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\Core\Block\Plugin\Block\Broken implements BlockPluginInterface, ContainerFactoryPluginInterface uses BlockPluginTrait, CacheableDependencyTrait
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of Broken
1 file declares its use of Broken
- BlockManagerTest.php in core/
tests/ Drupal/ Tests/ Core/ Block/ BlockManagerTest.php
6 string references to 'Broken'
- View::addDisplay in core/
modules/ views/ src/ Entity/ View.php - Adds a new display handler to the view, automatically creating an ID.
- views.argument.schema.yml in core/
modules/ views/ config/ schema/ views.argument.schema.yml - core/modules/views/config/schema/views.argument.schema.yml
- views.field.schema.yml in core/
modules/ views/ config/ schema/ views.field.schema.yml - core/modules/views/config/schema/views.field.schema.yml
- views.filter.schema.yml in core/
modules/ views/ config/ schema/ views.filter.schema.yml - core/modules/views/config/schema/views.filter.schema.yml
- views.relationship.schema.yml in core/
modules/ views/ config/ schema/ views.relationship.schema.yml - core/modules/views/config/schema/views.relationship.schema.yml
File
- core/
lib/ Drupal/ Core/ Block/ Plugin/ Block/ Broken.php, line 23
Namespace
Drupal\Core\Block\Plugin\BlockView source
class Broken extends PluginBase implements BlockPluginInterface, ContainerFactoryPluginInterface {
use BlockPluginTrait;
use CacheableDependencyTrait;
/**
* The current user.
*
* @var \Drupal\Core\Session\AccountInterface
*/
protected $currentUser;
/**
* Creates a Broken Block instance.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin ID for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Session\AccountInterface $current_user
* The current user.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, AccountInterface $current_user) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->currentUser = $current_user;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('current_user'));
}
/**
* {@inheritdoc}
*/
public function build() {
$build = [];
if ($this->currentUser
->hasPermission('administer blocks')) {
$build += $this
->brokenMessage();
}
return $build;
}
/**
* {@inheritdoc}
*/
public function blockForm($form, FormStateInterface $form_state) {
return $this
->brokenMessage();
}
/**
* Generate message with debugging information as to why the block is broken.
*
* @return array
* Render array containing debug information.
*/
protected function brokenMessage() {
$build['message'] = [
'#markup' => $this
->t('This block is broken or missing. You may be missing content or you might need to enable the original module.'),
];
return $build;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BlockPluginInterface:: |
constant | Indicates the block label (title) should be displayed to end users. | ||
BlockPluginTrait:: |
protected | property | The transliteration service. | |
BlockPluginTrait:: |
public | function | ||
BlockPluginTrait:: |
protected | function | Returns generic default configuration for block plugins. | |
BlockPluginTrait:: |
protected | function | Indicates whether the block should be shown. | 16 |
BlockPluginTrait:: |
public | function | 13 | |
BlockPluginTrait:: |
public | function | 3 | |
BlockPluginTrait:: |
public | function | Creates a generic configuration form for all block types. Individual block plugins can add elements to this form by overriding BlockBase::blockForm(). Most block plugins should not override this method unless they need to alter the generic form elements. | |
BlockPluginTrait:: |
public | function | ||
BlockPluginTrait:: |
public | function | 19 | |
BlockPluginTrait:: |
public | function | 1 | |
BlockPluginTrait:: |
public | function | 1 | |
BlockPluginTrait:: |
public | function | 3 | |
BlockPluginTrait:: |
public | function | ||
BlockPluginTrait:: |
public | function | ||
BlockPluginTrait:: |
public | function | ||
BlockPluginTrait:: |
public | function | Sets the transliteration service. | |
BlockPluginTrait:: |
public | function | Most block plugins should not override this method. To add submission handling for a specific block type, override BlockBase::blockSubmit(). | |
BlockPluginTrait:: |
protected | function | Wraps the transliteration service. | |
BlockPluginTrait:: |
public | function | Most block plugins should not override this method. To add validation for a specific block type, override BlockBase::blockValidate(). | 1 |
Broken:: |
protected | property | The current user. | |
Broken:: |
public | function |
Returns the configuration form elements specific to this block plugin. Overrides BlockPluginTrait:: |
|
Broken:: |
protected | function | Generate message with debugging information as to why the block is broken. | |
Broken:: |
public | function |
Builds and returns the renderable array for this block plugin. Overrides BlockPluginInterface:: |
|
Broken:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
Broken:: |
public | function |
Creates a Broken Block instance. Overrides BlockPluginTrait:: |
|
CacheableDependencyTrait:: |
protected | property | Cache contexts. | |
CacheableDependencyTrait:: |
protected | property | Cache max-age. | |
CacheableDependencyTrait:: |
protected | property | Cache tags. | |
CacheableDependencyTrait:: |
public | function | 4 | |
CacheableDependencyTrait:: |
public | function | 4 | |
CacheableDependencyTrait:: |
public | function | 4 | |
CacheableDependencyTrait:: |
protected | function | Sets cacheability; useful for value object constructors. | |
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 27 |
MessengerTrait:: |
public | function | Gets the messenger. | 27 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
2 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginWithFormsTrait:: |
public | function | Implements \Drupal\Core\Plugin\PluginWithFormsInterface::getFormClass(). | |
PluginWithFormsTrait:: |
public | function | Implements \Drupal\Core\Plugin\PluginWithFormsInterface::hasFormClass(). | |
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |