You are here

gutenberg.post_update.php in Gutenberg 8.2

Same filename and directory in other branches
  1. 8 gutenberg.post_update.php

Post update functions for Gutenberg.

File

gutenberg.post_update.php
View source
<?php

/**
 * @file
 * Post update functions for Gutenberg.
 */
use Drupal\views\Entity\View;

/**
 * Add access restriction to reusable blocks view.
 */
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();
      }
    }
  }
}

Functions

Namesort descending Description
gutenberg_post_update_reusable_block_view_access Add access restriction to reusable blocks view.