b97f2c5e85f00a179a4cff470766f7d290ce6f5c
[yaffs-website] / web / core / modules / workflows / tests / modules / workflow_type_test / workflow_type_test.module
1 <?php
2
3 /**
4  * @file
5  * Module file for workflow_type_test.
6  */
7
8 /**
9  * Implements hook_workflow_type_info_alter().
10  */
11 function workflow_type_test_workflow_type_info_alter(&$definitions) {
12   // Allow tests to override the workflow type definitions.
13   $state = \Drupal::state();
14   if ($state->get('workflow_type_test.plugin_definitions') !== NULL) {
15     $definitions = $state->get('workflow_type_test.plugin_definitions');
16   }
17 }
18
19 /**
20  * Sets the type plugin definitions override and clear the cache.
21  *
22  * @param array $definitions
23  *   Definitions to set.
24  */
25 function workflow_type_test_set_definitions($definitions) {
26   \Drupal::state()->set('workflow_type_test.plugin_definitions', $definitions);
27   \Drupal::service('plugin.manager.workflows.type')->clearCachedDefinitions();
28 }