diff --git a/os2forms_forloeb.module b/os2forms_forloeb.module index 45345e1..7205006 100644 --- a/os2forms_forloeb.module +++ b/os2forms_forloeb.module @@ -185,12 +185,21 @@ function os2forms_forloeb_spv_fetch_entity_username($uniqueWebformIdentifier, $w return $username; } +/** + * Returns array of custom task-types for OS2forms + * + */ +function os2forms_forloeb_get_custom_task_types() { + return ['MaestroWebformMultiple', 'MaestroWebformInherit']; +} + /** * Implements hook_form_alter() for MaestroWebformMultiple task type. * * This has been copied from * maestro/maestro_webform/maestro_webform.module with a minimal but * necessary change. See https://www.drupal.org/project/maestro/issues/3243510 + * When that issue has been fixed, this hook implementation can be safely deleted. * */ function os2forms_forloeb_form_alter(&$form, FormStateInterface $form_state, $form_id) { @@ -199,8 +208,10 @@ function os2forms_forloeb_form_alter(&$form, FormStateInterface $form_state, $fo // Both these keys need to exist. if ($isMaestro && $queueID) { $templateTask = MaestroEngine::getTemplateTaskByQueueID($queueID); - // We only care about Maestro Webform Multiple tasks. - if ($templateTask && $templateTask['tasktype'] == 'MaestroWebformMultiple') { + // Get array of custom task-types + $os2forms_forloeb_custom_task_types = os2forms_forloeb_get_custom_task_types(); + // We only care about custom Task-types defined in os2forms_forloeb_get_custom_task_types() + if ($templateTask && in_array($templateTask['tasktype'], $os2forms_forloeb_custom_task_types)) { $storage = $form_state->getStorage(); if ($storage && array_key_exists('form_display', $storage)) { $webformTypes = \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple();