function webform_update_8141 in Webform 8.5
Same name and namespace in other branches
- 6.x includes/webform.install.update.inc \webform_update_8141()
Issue #2993327: Provide Default View to Override Submission Results Tab.
File
- includes/
webform.install.update.inc, line 2597 - Archived Webform update hooks.
Code
function webform_update_8141() {
_webform_update_admin_settings();
_webform_update_webform_settings();
// Copied from: redirect_update_8103()
$message = NULL;
if (\Drupal::moduleHandler()
->moduleExists('views') && !View::load('webform_submissions')) {
$config_path = drupal_get_path('module', 'webform') . '/config/optional/views.view.webform_submissions.yml';
$data = [
'uuid' => (new Uuid())
->generate(),
] + Yaml::decode(file_get_contents($config_path));
\Drupal::configFactory()
->getEditable('views.view.webform_submissions')
->setData($data)
->save(TRUE);
$message = 'The new webform submissions view has been created.';
}
else {
$message = 'Not creating a webform submissions view since it already exists.';
}
return $message;
}