You are here

public static function MaestroEngine::getPluginTask in Maestro 8.2

Same name and namespace in other branches
  1. 3.x src/Engine/MaestroEngine.php \Drupal\maestro\Engine\MaestroEngine::getPluginTask()

Returns the $task variable populated with a Maestro Task plugin. See the getExecutableFormFields method in MaestroInteractiveFormBase class to see how you can fetch and use a task.

Parameters

string $taskClassName: The task's class name.

int $processID: Optional.

int $queueID: Optional.

Return value

mixed|NULL $task The task is returned in the $task variable. This is one of the plugins defined in Drupal\maestro\Plugin\EngineTasks

12 calls to MaestroEngine::getPluginTask()
MaestroEngine::cleanQueue in src/Engine/MaestroEngine.php
CleanQueue method This is the core method used by the orchestrator to move the process forward and to determine assignments and next steps.
MaestroEngine::createProductionTask in src/Engine/MaestroEngine.php
Creates a task in the Maestro Queue table.
MaestroEngine::performTemplateValidityCheck in src/Engine/MaestroEngine.php
Checks the validity of the template in question.
MaestroEngine::productionAssignments in src/Engine/MaestroEngine.php
Using the queueID, the task's machine name and the template machine name, we assign the task using the appropriate method defined in the template.
MaestroInteractiveFormBase::getExecutableFormFields in src/Form/MaestroInteractiveFormBase.php
Returns the executable form fields for this interactive task.

... See full list

File

src/Engine/MaestroEngine.php, line 676

Class

MaestroEngine
Class MaestroEngine.

Namespace

Drupal\maestro\Engine

Code

public static function getPluginTask($taskClassName, $processID = 0, $queueID = 0) {
  $manager = \Drupal::service('plugin.manager.maestro_tasks');
  $plugins = $manager
    ->getDefinitions();
  $task = NULL;

  // Ensure that this task type exists.
  if (array_key_exists($taskClassName, $plugins)) {
    $task = $manager
      ->createInstance($plugins[$taskClassName]['id'], [
      $processID,
      $queueID,
    ]);
  }
  return $task;
}