You are here

function layout_builder_post_update_update_permissions in Drupal 8

Add new custom block permission to all roles with 'configure any layout'.

File

core/modules/layout_builder/layout_builder.post_update.php, line 185
Post update functions for Layout Builder.

Code

function layout_builder_post_update_update_permissions() {
  foreach (Role::loadMultiple() as $role) {
    if ($role
      ->hasPermission('configure any layout')) {
      $role
        ->grantPermission('create and edit custom blocks')
        ->save();
    }
  }
}