function business_rules_update_8101 in Business Rules 8
Same name and namespace in other branches
- 2.x business_rules.install \business_rules_update_8101()
Update the email actions to allow HTML.
File
- ./
business_rules.install, line 10
Code
function business_rules_update_8101(&$sandbox) {
$actions = Action::loadMultiple();
/** @var \Drupal\business_rules\Entity\Action $action */
foreach ($actions as $key => $action) {
if ($action
->getType() == 'send_email') {
$old_body = $action
->getSettings('body');
if (!is_array($old_body)) {
$new_body = [
'format' => 'full_html',
'value' => $old_body,
];
$action
->setSetting('body', $new_body);
$action
->save();
}
}
}
}