You are here

protected function ExecutablePluginTrait::getLabelValue in Rules 8.3

Get the translated label from the plugin definition.

Return value

string The label of the plugin.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException Thrown if the label is not defined for the plugin.

1 call to ExecutablePluginTrait::getLabelValue()
ExecutablePluginTrait::summary in src/Core/ExecutablePluginTrait.php
Get the translated summary from the label annotation.

File

src/Core/ExecutablePluginTrait.php, line 21

Class

ExecutablePluginTrait
Offers common methods for executable plugins.

Namespace

Drupal\rules\Core

Code

protected function getLabelValue() {
  $definition = $this
    ->getPluginDefinition();
  if (empty($definition['label'])) {
    throw new InvalidPluginDefinitionException('The label is not defined for plugin ' . $this
      ->getPluginId() . ' (' . __CLASS__ . ').');
  }

  // The label can be an instance of
  // \Drupal\Core\StringTranslation\TranslatableMarkup here, so make sure to
  // always return a primitive string representation here.
  return (string) $definition['label'];
}