You are here

public function WorkflowStateListBuilder::getDefaultOperations in Workflow 8

Gets this list's default operations.

Parameters

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

Return value

array The array structure is identical to the return value of self::getOperations().

Overrides ConfigEntityListBuilder::getDefaultOperations

File

src/WorkflowStateListBuilder.php, line 235

Class

WorkflowStateListBuilder
Defines a class to build a draggable listing of Workflow State entities.

Namespace

Drupal\workflow

Code

public function getDefaultOperations(EntityInterface $entity) {
  $operations = parent::getDefaultOperations($entity);

  /** @var \Drupal\workflow\Entity\WorkflowState $state */
  $state = $entity;

  /*
   * Allow modules to insert their own workflow operations to the list.
   */

  // This is what EntityListBuilder::getOperations() does:
  // $operations = $this->getDefaultOperations($entity);
  // $operations += $this->moduleHandler()->invokeAll('entity_operation', [$entity]);
  // $this->moduleHandler->alter('entity_operation', $operations, $entity);
  // In D8, the interface of below hook_workflow_operations has changed a bit.
  // @see EntityListBuilder::getOperations, workflow_operations, workflow.api.php.
  $operations += $this
    ->moduleHandler()
    ->invokeAll('workflow_operations', [
    'state',
    $state,
  ]);
  return $operations;
}