Created by
Daniel Sasser
| diff --git a/src/modules/deploy/oar_deploy_target/oar_deploy_target.drush.inc b/src/modules/deploy/oar_deploy_target/oar_deploy_target.drush.inc
index 8fd2eea2..2c6bad7c 100644
--- a/src/modules/deploy/oar_deploy_target/oar_deploy_target.drush.inc
+++ b/src/modules/deploy/oar_deploy_target/oar_deploy_target.drush.inc
@@ -108,6 +108,15 @@ function drush_oar_deploy_target_adapt_config() {
}
}
}
+ // Set the non-blocking value for the deploy_trigger_target webhook if needed.
+ $manager = \Drupal::entityTypeManager()->getStorage('webhook_config');
+ /** @var \Drupal\webhooks\Entity\WebhookConfig $webhook */
+ $webhook = $manager->load('deploy_trigger_target');
+ if ($webhook && !$webhook->getNonBlocking()) {
+ $webhook->set('non_blocking', TRUE);
+ $webhook->save();
+ }
+
}
/**
diff --git a/src/modules/deploy/oar_deploy_target/oar_deploy_target.install b/src/modules/deploy/oar_deploy_target/oar_deploy_target.install
index 26a87ab4..1a0eec0b 100644
--- a/src/modules/deploy/oar_deploy_target/oar_deploy_target.install
+++ b/src/modules/deploy/oar_deploy_target/oar_deploy_target.install
@@ -63,6 +63,19 @@ function oar_deploy_target_update_8105() {
}
/**
+ * Set the non-blocking value for the deploy_trigger_target webhook if needed.
+ */
+function oar_deploy_target_update_8106() {
+ $manager = \Drupal::entityTypeManager()->getStorage('webhook_config');
+ /** @var \Drupal\webhooks\Entity\WebhookConfig $webhook */
+ $webhook = $manager->load('deploy_trigger_target');
+ if ($webhook && !$webhook->getNonBlocking()) {
+ $webhook->set('non_blocking', TRUE);
+ $webhook->save();
+ }
+}
+
+/**
* Adjust migration configurations for current environment.
*
* Deployment migrations pull from absolute source URLs, each environment with
diff --git a/src/modules/deploy/oar_deploy_target/oar_deploy_target.module b/src/modules/deploy/oar_deploy_target/oar_deploy_target.module
index b979d5ee..9f8634bb 100644
--- a/src/modules/deploy/oar_deploy_target/oar_deploy_target.module
+++ b/src/modules/deploy/oar_deploy_target/oar_deploy_target.module
@@ -6,6 +6,7 @@
*/
use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_help().
@@ -22,3 +23,19 @@ function oar_deploy_target_help($route_name, RouteMatchInterface $route_match) {
default:
}
}
+
+/**
+ * Implements hook_form_FORM_ID_alter().
+ */
+function oar_deploy_target_form_webhook_config_edit_form_alter(&$form, FormStateInterface $form_state, $form_id) {
+ /** @var \Drupal\webhooks\form\WebhookConfigForm $obj */
+ $obj = $form_state->getFormObject();
+ // The incoming webhook requests for `deploy_trigger_target` need the
+ // non-blocking value to be set in order for the downstream events to trigger.
+ if ($obj->getEntity()->id() === 'deploy_trigger_target' && isset($form['incoming']['non_blocking'])) {
+ $form['incoming']['non_blocking']['#default_value'] = TRUE;
+ $form['incoming']['non_blocking']['#disabled'] = TRUE;
+ // Prevent form state api from re-enabling the element.
+ unset($form['incoming']['#states']['enabled']);
+ }
+}
|