function data_policy_update_8003 in Data Policy 8
Add default consent_text to data policy and set default entity name.
File
- ./
data_policy.install, line 115 - Install, update and uninstall functions for the data_policy module.
Code
function data_policy_update_8003() {
$data_policy = \Drupal::entityTypeManager()
->getStorage('data_policy')
->load(1);
if ($data_policy instanceof DataPolicyInterface && empty($data_policy
->getName())) {
$data_policy
->setName('Data Policy');
$data_policy
->save();
}
$data_policy_config = \Drupal::configFactory()
->getEditable('data_policy.data_policy');
$data_policy_config
->set('consent_text', 'I agree with the [id:1]');
$data_policy_config
->save();
}