YamlDiscovery
class YamlDiscovery implements DiscoveryInterface (View source)
Allows YAML files to define plugin definitions.
If the value of a key (like title) in the definition is translatable then the addTranslatableProperty() method can be used to mark it as such and also to add translation context. Then \Drupal\Core\StringTranslation\TranslatableMarkup will be used to translate the string and also to mark it safe. Only strings written in the YAML files should be marked as safe, strings coming from dynamic plugin definitions potentially containing user input should not.
Traits
Properties
| protected YamlDiscovery | $discovery | YAML file discovery and parsing handler. |
|
| protected array | $translatableProperties | Contains an array of translatable properties passed along to t(). |
Methods
Gets the definition of all plugins for this type.
Gets a specific plugin definition.
Construct a YamlDiscovery object.
Set one of the YAML values as being translatable.
Details
array
getDefinitions()
Gets the definition of all plugins for this type.
getDefinition($plugin_id, $exception_on_invalid = TRUE)
{@inheritdoc}
protected array|null
doGetDefinition(array $definitions, string $plugin_id, bool $exception_on_invalid)
Gets a specific plugin definition.
hasDefinition($plugin_id)
{@inheritdoc}
__construct(string $name, array $directories)
Construct a YamlDiscovery object.
$this
addTranslatableProperty(string $value_key, string $context_key = '')
Set one of the YAML values as being translatable.