UtilsController.php in Gutenberg 8
Same filename and directory in other branches
Namespace
Drupal\gutenberg\ControllerFile
src/Controller/UtilsController.phpView source
<?php
namespace Drupal\gutenberg\Controller;
use Symfony\Component\Yaml\Yaml;
use Drupal\Core\Controller\ControllerBase;
/**
* Utility controller.
*/
class UtilsController extends ControllerBase {
/**
* Get blocks settings.
*/
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;
}
}
Classes
Name | Description |
---|---|
UtilsController | Utility controller. |