You are here

public static function UtilsController::getAllowedBlocks in Gutenberg 8.2

Gets allowed blocks.

1 call to UtilsController::getAllowedBlocks()
gutenberg_form_alter in ./gutenberg.module
Implements hook_form_alter().

File

src/Controller/UtilsController.php, line 39

Class

UtilsController
Utility controller.

Namespace

Drupal\gutenberg\Controller

Code

public static function getAllowedBlocks() {
  $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;
}