Same name and namespace in other branches
  1. 8.9.x core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php \Drupal\config_translation\Controller\ConfigTranslationEntityListBuilder::getOperations()
  2. 9 core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php \Drupal\config_translation\Controller\ConfigTranslationEntityListBuilder::getOperations()

Provides an array of information to build a list of operation links.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity the operations are for.

Return value

array An associative array of operation link data for this list, keyed by operation name, containing the following key-value pairs:

  • title: The localized title of the operation.
  • url: An instance of \Drupal\Core\Url for the operation URL.
  • weight: The weight of this operation.

Overrides EntityListBuilder::getOperations

File

core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php, line 82

Class

ConfigTranslationEntityListBuilder
Defines the configuration translation list builder for entities.

Namespace

Drupal\config_translation\Controller

Code

public function getOperations(EntityInterface $entity) {
  $operations = parent::getOperations($entity);
  foreach (array_keys($operations) as $operation) {

    // This is a translation UI for translators. Show the translation
    // operation only.
    if (!($operation == 'translate')) {
      unset($operations[$operation]);
    }
  }
  return $operations;
}