You are here

public function MaestroContentTypeTask::performValidityCheck in Maestro 8.2

Same name and namespace in other branches
  1. 3.x src/Plugin/EngineTasks/MaestroContentTypeTask.php \Drupal\maestro\Plugin\EngineTasks\MaestroContentTypeTask::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/MaestroContentTypeTask.php, line 271

Class

MaestroContentTypeTask
Maestro Content Type Task Plugin.

Namespace

Drupal\maestro\Plugin\EngineTasks

Code

public function performValidityCheck(array &$validation_failure_tasks, array &$validation_information_tasks, array $task) {
  if (array_key_exists('unique_id', $task['data']) && $task['data']['unique_id'] == '' || !array_key_exists('unique_id', $task['data'])) {
    $validation_failure_tasks[] = [
      'taskID' => $task['id'],
      'taskLabel' => $task['label'],
      'reason' => t('The Content Type Task has not been set up properly.  The "unique identifier" option is missing and thus the engine will be unable to execute this task.'),
    ];
  }
  if (array_key_exists('content_type', $task['data']) && $task['data']['content_type'] == '' || !array_key_exists('content_type', $task['data'])) {
    $validation_failure_tasks[] = [
      'taskID' => $task['id'],
      'taskLabel' => $task['label'],
      'reason' => t('The Content Type Task has not been set up properly.  The "content type" option is missing and thus the engine will be unable to execute this task.'),
    ];
  }
  if (array_key_exists('redirect_to', $task['data']) && $task['data']['redirect_to'] == '' || !array_key_exists('redirect_to', $task['data'])) {
    $validation_failure_tasks[] = [
      'taskID' => $task['id'],
      'taskLabel' => $task['label'],
      'reason' => t('The Content Type Task has not been set up properly.  The "Return Path" option is missing and thus the engine will be unable to execute this task.'),
    ];
  }
}