function block_content_post_update_sort_permissions
Update permissions for users with "administer blocks" permission.
File
-
core/
modules/ block_content/ block_content.post_update.php, line 73
Code
function block_content_post_update_sort_permissions(&$sandbox = NULL) {
\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'user_role', function (Role $role) {
if ($role->hasPermission('administer blocks')) {
$role->grantPermission('administer block content');
$role->grantPermission('access block library');
$role->grantPermission('administer block types');
return TRUE;
}
return FALSE;
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.