You are here

function _webform_update_actions in Webform 8.5

Same name and namespace in other branches
  1. 6.x includes/webform.install.inc \_webform_update_actions()

Update or install any new system.actions.* config entities.

2 calls to _webform_update_actions()
webform_update_8013 in includes/webform.install.update.inc
Issue #2840858: Create Webform and Webform Submission Action plugins.
webform_update_8213 in includes/webform.install.update.inc
Issue #3220703: Add support for bulk operations on webform entities.

File

includes/webform.install.inc, line 289
Webform install helper functions.

Code

function _webform_update_actions() {
  $files = \Drupal::service('file_system')
    ->scanDirectory(drupal_get_path('module', 'webform') . '/config', '/^system.action..*\\.yml$/');
  foreach ($files as $path => $file) {
    $action_id = str_replace('system.action.', '', $file->name);
    $action = Action::load($action_id);
    if (!$action) {

      // Install new action.
      $data = Yaml::decode(file_get_contents($path));
      $action = Action::create($data);
      $action
        ->trustData()
        ->save();
    }
  }
}