class UnassignTask

Redirects to a task assign form.

Plugin annotation


@Action(
  id = "tmgmt_local_task_unassign_multiple",
  label = @Translation("Unassign"),
  type = "tmgmt_local_task",
)

Hierarchy

  • class \Drupal\tmgmt_local\Plugin\Action\UnassignTask extends \Drupal\Core\Action\ActionBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface

Expanded class hierarchy of UnassignTask

File

translators/tmgmt_local/src/Plugin/Action/UnassignTask.php, line 19

Namespace

Drupal\tmgmt_local\Plugin\Action
View source
class UnassignTask extends ActionBase implements ContainerFactoryPluginInterface {

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition);
  }

  /**
   * {@inheritdoc}
   */
  public function executeMultiple(array $entities) {

    /** @var \Drupal\tmgmt_local\LocalTaskInterface $task */
    foreach ($entities as $task) {
      $task
        ->unassign();
      $task
        ->save();
    }
  }

  /**
   * {@inheritdoc}
   */
  public function execute($object = NULL) {
    $this
      ->executeMultiple(array(
      $object,
    ));
  }

  /**
   * {@inheritdoc}
   */
  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
    return $object
      ->access('unassign', $account, $return_as_object);
  }

}

Members