You are here

public static function MaestroTemplateBuilderAddNew::exists in Maestro 3.x

Same name and namespace in other branches
  1. 8.2 modules/maestro_template_builder/src/Form/MaestroTemplateBuilderAddNew.php \Drupal\maestro_template_builder\Form\MaestroTemplateBuilderAddNew::exists()

File

modules/maestro_template_builder/src/Form/MaestroTemplateBuilderAddNew.php, line 28

Class

MaestroTemplateBuilderAddNew
Maestro Template Builder Add New form.

Namespace

Drupal\maestro_template_builder\Form

Code

public static function exists($submitted_value, array $element, FormStateInterface $form_state) {
  $templateMachineName = $form_state
    ->getValue('template_machine_name');
  $template = MaestroEngine::getTemplate($templateMachineName);
  $tasks = $template->tasks;
  if (array_key_exists($submitted_value, $tasks) == TRUE) {
    return TRUE;
  }
  return FALSE;
}