You are here

public static function MaestroEngine::getTaskPointersFromTemplate in Maestro 8.2

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

Determines which task(s) point to the task in question.

Parameters

string $templateMachineName: The template of the task you wish to investigate.

string $taskMachineName: The task you want to know WHO points to it.

Return value

array Returns an array of resulting task machine names (IDs) or empty array.

6 calls to MaestroEngine::getTaskPointersFromTemplate()
MaestroAndTask::execute in src/Plugin/EngineTasks/MaestroAndTask.php
Part of the ExecutableInterface Execution of the AND task returns TRUE when all pointers are complete and FALSE when still waiting.. .
MaestroEngine::nextStep in src/Engine/MaestroEngine.php
NextStep Engine method that determines which is the next step based on the current step and does all assignments as necessary.
MaestroEngine::performTemplateValidityCheck in src/Engine/MaestroEngine.php
Checks the validity of the template in question.
MaestroEngine::removeTemplateTask in src/Engine/MaestroEngine.php
Removes a template task.
MaestroIfTask::execute in src/Plugin/EngineTasks/MaestroIfTask.php
Part of the ExecutableInterface Execution of the Batch Function task will use the handler for this task as the executable function. .

... See full list

File

src/Engine/MaestroEngine.php, line 269

Class

MaestroEngine
Class MaestroEngine.

Namespace

Drupal\maestro\Engine

Code

public static function getTaskPointersFromTemplate($templateMachineName, $taskMachineName) {
  $template = MaestroEngine::getTemplate($templateMachineName);
  $pointers = [];
  foreach ($template->tasks as $task) {
    $nextSteps = explode(',', $task['nextstep']);
    $nextFalseSteps = explode(',', $task['nextfalsestep']);
    if (array_search($taskMachineName, $nextSteps) !== FALSE || array_search($taskMachineName, $nextFalseSteps) !== FALSE) {
      $pointers[] = $task['id'];
    }
  }
  return $pointers;
}