Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
CRAP
n/a
0 / 0
authorization_update_8001
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3/**
4 * @file
5 * Contains installation and update hooks.
6 */
7
8declare(strict_types=1);
9
10use Drupal\authorization\Entity\AuthorizationProfile;
11
12/**
13 * Schema corrections.
14 */
15function authorization_update_8001() {
16  $config_factory = \Drupal::configFactory();
17  $config = $config_factory->getEditable('authorization.settings');
18  $config->set('authorization_message', $config->get('authorization_message'));
19  $config->clear('authorization_message');
20  $config->save();
21
22  $result = \Drupal::entityQuery('authorization_profile')->execute();
23  $profiles = AuthorizationProfile::loadMultiple($result);
24  foreach ($profiles as $profile) {
25    $profile->save();
26  }
27
28  return t('Your authorization configuration and profiles have been updated, please review.');
29}