TitleBlockPluginInterface
interface TitleBlockPluginInterface implements BlockPluginInterface (View source)
The interface for "title" blocks.
A title block shows the title returned by the controller.
Methods
Sets the configuration for this plugin instance.
Calculates dependencies for the configured plugin.
Gets the definition of the plugin implementation.
The cache contexts associated with this object.
The cache tags associated with this object.
The maximum age for which this object may be cached.
Gets the base_plugin_id of the plugin instance.
Gets the derivative_id of the plugin instance.
Indicates whether the block should be shown.
Builds and returns the renderable array for this block plugin.
Sets a particular value in the block settings.
Returns the configuration form elements specific to this block plugin.
Adds block type-specific validation for the block form.
Adds block type-specific submission handling for the block form.
Suggests a machine name to identify an instance of this block.
Sets the title.
Details
array
getConfiguration()
Gets this plugin's configuration.
setConfiguration(array $configuration)
Sets the configuration for this plugin instance.
array
defaultConfiguration()
Gets default configuration for this plugin.
array
calculateDependencies()
Calculates dependencies for the configured plugin.
Dependencies are saved in the plugin's configuration entity and are used to determine configuration synchronization order. For example, if the plugin integrates with specific user roles, this method should return an array of dependencies listing the specified roles.
array
buildConfigurationForm(array $form, FormStateInterface $form_state)
Form constructor.
Plugin forms are embedded in other forms. In order to know where the plugin form is located in the parent form, #parents and #array_parents must be known, but these are not available during the initial build phase. In order to have these properties available when building the plugin form's elements, let this method return a form element that has a #process callback and build the rest of the form in the callback. By the time the callback is executed, the element's #parents and #array_parents properties will have been set by the form API. For more documentation on #parents and
array_parents, see \Drupal\Core\Render\Element\FormElement.
validateConfigurationForm(array $form, FormStateInterface $form_state)
Form validation handler.
submitConfigurationForm(array $form, FormStateInterface $form_state)
Form submission handler.
string
getPluginId()
Gets the plugin_id of the plugin instance.
array
getPluginDefinition()
Gets the definition of the plugin implementation.
string[]
getCacheContexts()
The cache contexts associated with this object.
These identify a specific variation/representation of the object.
Cache contexts are tokens: placeholders that are converted to cache keys by the @cache_contexts_manager service. The replacement value depends on the request context (the current URL, language, and so on). They're converted before storing an object in cache.
string[]
getCacheTags()
The cache tags associated with this object.
When this object is modified, these cache tags will be invalidated.
int
getCacheMaxAge()
The maximum age for which this object may be cached.
string
getBaseId()
Gets the base_plugin_id of the plugin instance.
string|null
getDerivativeId()
Gets the derivative_id of the plugin instance.
string
label()
Returns the user-facing block label.
bool|AccessResultInterface
access(AccountInterface $account, bool $return_as_object = FALSE)
Indicates whether the block should be shown.
This method allows base implementations to add general access restrictions that should apply to all extending block plugins.
array
build()
Builds and returns the renderable array for this block plugin.
If a block should not be rendered because it has no content, then this method must also ensure to return no content: it must then only return an empty array, or an empty array with #cache set (with cacheability metadata indicating the circumstances for it being empty).
setConfigurationValue(string $key, mixed $value)
Sets a particular value in the block settings.
array
blockForm(array $form, FormStateInterface $form_state)
Returns the configuration form elements specific to this block plugin.
Blocks that need to add form elements to the normal block configuration form should implement this method.
blockValidate(array $form, FormStateInterface $form_state)
Adds block type-specific validation for the block form.
Note that this method takes the form structure and form state for the full block configuration form as arguments, not just the elements defined in BlockPluginInterface::blockForm().
blockSubmit(array $form, FormStateInterface $form_state)
Adds block type-specific submission handling for the block form.
Note that this method takes the form structure and form state for the full block configuration form as arguments, not just the elements defined in BlockPluginInterface::blockForm().
string
getMachineNameSuggestion()
Suggests a machine name to identify an instance of this block.
The block plugin need not verify that the machine name is at all unique. It is only responsible for providing a baseline suggestion; calling code is responsible for ensuring whatever uniqueness is required for the use case.
setTitle(string|array $title)
Sets the title.