# gutenberg/8.3.0/lib/editor-features.php

Gutenberg, version 8.3.0. 50 lines.

- Page: https://pluginprobe.com/plugins/gutenberg/8.3.0/code/lib/editor-features.php
- Raw: https://pluginprobe.com/plugins/gutenberg/8.3.0/raw/lib/editor-features.php
- Modified: 2020-06-11T09:46:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/gutenberg/8.3.0/code/lib/editor-features.php#L10-L20`.

```php
<?php
/**
 * Experimental editor features config functionality.
 *
 * @package gutenberg
 */

/**
 * Returns the default config for editor features,
 * or an empty array if none found.
 *
 * @return array Default features config for the editor.
 */
function gutenberg_experimental_get_editor_features_config() {
	$empty_config = array();
	$config_path  = __DIR__ . '/experimental-default-theme.json';
	if ( ! file_exists( $config_path ) ) {
		return $empty_config;
	}

	$theme_config = json_decode(
		@file_get_contents( $config_path ),
		true
	);
	if (
		empty( $theme_config['global']['features'] ) ||
		! is_array( $theme_config['global']['features'] )
	) {
		return $empty_config;
	}

	return $theme_config['global']['features'];
}


/**
 * Extends editor settings with the features loaded from default config.
 *
 * @param array $settings Default editor settings.
 *
 * @return array Filtered editor settings.
 */
function gutenberg_extend_settings_editor_features( $settings ) {
	$editor_features                    = gutenberg_experimental_get_editor_features_config();
	$settings['__experimentalFeatures'] = $editor_features;

	return $settings;
}
add_filter( 'block_editor_settings', 'gutenberg_extend_settings_editor_features' );

```
