function gutenberg_post_update_reusable_block_view_access in Gutenberg 8.2
Same name and namespace in other branches
- 8 gutenberg.post_update.php \gutenberg_post_update_reusable_block_view_access()
Add access restriction to reusable blocks view.
File
- ./
gutenberg.post_update.php, line 13 - Post update functions for Gutenberg.
Code
function gutenberg_post_update_reusable_block_view_access() {
if (\Drupal::moduleHandler()
->moduleExists('views')) {
if ($view = View::load('reusable_blocks')) {
$display =& $view
->getDisplay('default');
if (!isset($display['display_options']['access']['type']) || $display['display_options']['access']['type'] === 'none') {
$display['display_options']['access'] = [
'type' => 'perm',
'options' => [
'perm' => 'use gutenberg',
],
];
$view
->save();
}
}
}
}