Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions os2forms_forloeb.module
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
Expand Down