You are here

public function LingotekProfileListBuilder::getOperations in Lingotek Translation 8.2

Same name and namespace in other branches
  1. 8 src/LingotekProfileListBuilder.php \Drupal\lingotek\LingotekProfileListBuilder::getOperations()
  2. 4.0.x src/LingotekProfileListBuilder.php \Drupal\lingotek\LingotekProfileListBuilder::getOperations()
  3. 3.0.x src/LingotekProfileListBuilder.php \Drupal\lingotek\LingotekProfileListBuilder::getOperations()
  4. 3.1.x src/LingotekProfileListBuilder.php \Drupal\lingotek\LingotekProfileListBuilder::getOperations()
  5. 3.2.x src/LingotekProfileListBuilder.php \Drupal\lingotek\LingotekProfileListBuilder::getOperations()
  6. 3.3.x src/LingotekProfileListBuilder.php \Drupal\lingotek\LingotekProfileListBuilder::getOperations()
  7. 3.4.x src/LingotekProfileListBuilder.php \Drupal\lingotek\LingotekProfileListBuilder::getOperations()
  8. 3.5.x src/LingotekProfileListBuilder.php \Drupal\lingotek\LingotekProfileListBuilder::getOperations()
  9. 3.6.x src/LingotekProfileListBuilder.php \Drupal\lingotek\LingotekProfileListBuilder::getOperations()
  10. 3.7.x src/LingotekProfileListBuilder.php \Drupal\lingotek\LingotekProfileListBuilder::getOperations()
  11. 3.8.x src/LingotekProfileListBuilder.php \Drupal\lingotek\LingotekProfileListBuilder::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

src/LingotekProfileListBuilder.php, line 155

Class

LingotekProfileListBuilder
Defines a class to build a listing of Lingotek profile entities.

Namespace

Drupal\lingotek

Code

public function getOperations(EntityInterface $entity) {

  // We don't call parent, as we don't want config_translation operations.
  $operations = [];
  if (!$entity
    ->isLocked() && $entity
    ->hasLinkTemplate('edit-form')) {
    $operations['edit'] = [
      'title' => $this
        ->t('Edit'),
      'weight' => 10,
      'url' => $entity
        ->toUrl('edit-form'),
    ];
  }
  if (!$entity
    ->isLocked() && $entity
    ->hasLinkTemplate('delete-form')) {
    $operations['delete'] = [
      'title' => $this
        ->t('Delete'),
      'weight' => 100,
      'url' => $entity
        ->toUrl('delete-form'),
    ];
  }
  return $operations;
}