You are here

function _gutenberg_get_allowed_blocks in Gutenberg 8

Gets allowed blocks.

1 call to _gutenberg_get_allowed_blocks()
gutenberg_form_alter in ./gutenberg.module
Implements hook_form_alter().

File

./gutenberg.module, line 855
Provides integration with the Gutenberg editor.

Code

function _gutenberg_get_allowed_blocks() {
  $settings =& drupal_static(__FUNCTION__);
  if (!isset($settings)) {
    $module_handler = \Drupal::service('module_handler');
    $path = $module_handler
      ->getModule('gutenberg')
      ->getPath();
    $file_path = DRUPAL_ROOT . '/' . $path . '/' . 'gutenberg.blocks.yml';
    if (file_exists($file_path)) {
      $file_contents = file_get_contents($file_path);
      $settings = Yaml::parse($file_contents);
    }
  }
  return $settings;
}