You are here

protected function EntityReferenceActionsHandler::getActionLabel in Entity reference actions 1.x

Returns the label for an action.

Parameters

\Drupal\system\ActionConfigEntityInterface $action: The action.

Return value

string The action label.

Throws

\Drupal\Component\Plugin\Exception\PluginNotFoundException

2 calls to EntityReferenceActionsHandler::getActionLabel()
EntityReferenceActionsHandler::getBulkOptions in src/EntityReferenceActionsHandler.php
Returns the available operations for this form.
EntityReferenceActionsHandler::submitForm in src/EntityReferenceActionsHandler.php
Submit function to call the action.

File

src/EntityReferenceActionsHandler.php, line 485

Class

EntityReferenceActionsHandler
Provides the form functions to call actions on referenced entities.

Namespace

Drupal\entity_reference_actions

Code

protected function getActionLabel(ActionConfigEntityInterface $action) {
  $entity_type = $this->entityTypeManager
    ->getDefinition($this->entityTypeId);
  $label = $action
    ->label();
  if (isset($action
    ->getPlugin()
    ->getPluginDefinition()['action_label'])) {
    $label = sprintf('%s all %s', $action
      ->getPlugin()
      ->getPluginDefinition()['action_label'], $entity_type
      ->getPluralLabel());
  }
  return $label;
}