You are here

function _gutenberg_get_default_theme_settings in Gutenberg 8

Gets default theme settings.

2 calls to _gutenberg_get_default_theme_settings()
gutenberg_form_node_form_alter in ./gutenberg.module
Implements hook_form_node_form_alter().
gutenberg_page_attachments in ./gutenberg.module
Implements hook_page_attachments().

File

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

Code

function _gutenberg_get_default_theme_settings() {
  $settings =& drupal_static(__FUNCTION__);
  if (!isset($settings)) {
    $theme_name = \Drupal::config('system.theme')
      ->get('default');
    $theme_path = drupal_get_path('theme', $theme_name);
    $file_path = DRUPAL_ROOT . '/' . $theme_path . '/' . $theme_name . '.gutenberg.yml';
    if (file_exists($file_path)) {
      $file_contents = file_get_contents($file_path);
      $settings = Yaml::parse($file_contents);
    }
    else {
      $settings = [];
    }
  }
  return $settings;
}