(v 3.2) Make droopler_update_8134() less vulnerable to removing editor role

Created on 28 September 2022, almost 2 years ago
Updated 10 January 2024, 6 months ago

If you deleted the d_editor role on your site, the droopler_update_8134() will fail.
With a condition on $role object , it's perfect :)

function droopler_update_8134() {
  $permission = 'access contextual links';

  $role = Role::load('d_editor');
  if (is_object($role)) // Test if this role exists
  {
        $role->grantPermission($permission)
            ->save();

          $values['droopler__droopler_update_8134_1'] = $role->hasPermission($permission);
  }

  Drupal::service('d_update')
    ->checklist()
    ->saveProgress(['v3.1' => $values]);
}
🐛 Bug report
Status

Needs review

Version

3.1

Component

Code

Created by

🇫🇷France perpignan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024