You are here

public function MaestroBatchFunctionTask::performValidityCheck in Maestro 8.2

Same name and namespace in other branches
  1. 3.x src/Plugin/EngineTasks/MaestroBatchFunctionTask.php \Drupal\maestro\Plugin\EngineTasks\MaestroBatchFunctionTask::performValidityCheck()

Lets the task perform validation on itself. If the task is missing any internal requirements, it can flag itself as having an issue. Return array MUST be in the format of array( 'taskID' => the task machine name, 'taskLabel' => the human readable label for the task, 'reason' => the reason for the failure )

Parameters

array $validation_failure_tasks: The array of other validation failures.

array $validation_information_tasks: The array of informational messages.

array $task: The passed-in fully-loaded task from the template (array)

Overrides MaestroEngineTaskInterface::performValidityCheck

File

src/Plugin/EngineTasks/MaestroBatchFunctionTask.php, line 248

Class

MaestroBatchFunctionTask
Maestro Batch Function Task Plugin.

Namespace

Drupal\maestro\Plugin\EngineTasks

Code

public function performValidityCheck(array &$validation_failure_tasks, array &$validation_information_tasks, array $task) {

  // So we know that we need a few keys in this $task array to even have a batch function run properly.
  // namely the handler.
  if (array_key_exists('handler', $task) && $task['handler'] == '' || !array_key_exists('handler', $task)) {
    $validation_failure_tasks[] = [
      'taskID' => $task['id'],
      'taskLabel' => $task['label'],
      'reason' => t('The handler for the task has not been set. This will cause a failure of the engine to execute'),
    ];
  }
}