Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / workflows / tests / modules / workflow_type_test / workflow_type_test.module
diff --git a/web/core/modules/workflows/tests/modules/workflow_type_test/workflow_type_test.module b/web/core/modules/workflows/tests/modules/workflow_type_test/workflow_type_test.module
new file mode 100644 (file)
index 0000000..b97f2c5
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+/**
+ * @file
+ * Module file for workflow_type_test.
+ */
+
+/**
+ * Implements hook_workflow_type_info_alter().
+ */
+function workflow_type_test_workflow_type_info_alter(&$definitions) {
+  // Allow tests to override the workflow type definitions.
+  $state = \Drupal::state();
+  if ($state->get('workflow_type_test.plugin_definitions') !== NULL) {
+    $definitions = $state->get('workflow_type_test.plugin_definitions');
+  }
+}
+
+/**
+ * Sets the type plugin definitions override and clear the cache.
+ *
+ * @param array $definitions
+ *   Definitions to set.
+ */
+function workflow_type_test_set_definitions($definitions) {
+  \Drupal::state()->set('workflow_type_test.plugin_definitions', $definitions);
+  \Drupal::service('plugin.manager.workflows.type')->clearCachedDefinitions();
+}