You are here

public static function UtilsController::getBlocksSettings in Gutenberg 8.2

Same name and namespace in other branches
  1. 8 src/Controller/UtilsController.php \Drupal\gutenberg\Controller\UtilsController::getBlocksSettings()

Get blocks settings.

2 calls to UtilsController::getBlocksSettings()
Gutenberg::getJsSettings in src/Plugin/Editor/Gutenberg.php
Get javascript settings.
gutenberg_form_alter in ./gutenberg.module
Implements hook_form_alter().

File

src/Controller/UtilsController.php, line 19

Class

UtilsController
Utility controller.

Namespace

Drupal\gutenberg\Controller

Code

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