function gutenberg_theme_suggestions_node_edit_form_alter in Gutenberg 8
Same name and namespace in other branches
- 8.2 gutenberg.module \gutenberg_theme_suggestions_node_edit_form_alter()
Implements hook_theme_suggestions_HOOK_alter().
File
- ./
gutenberg.module, line 875 - Provides integration with the Gutenberg editor.
Code
function gutenberg_theme_suggestions_node_edit_form_alter(array &$suggestions, array $variables) {
$config = \Drupal::service('config.factory')
->getEditable('gutenberg.settings');
$node = \Drupal::routeMatch()
->getParameter('node');
if (!$node) {
$route_match = \Drupal::service('current_route_match');
if (!$route_match
->getParameter('node_type')) {
return;
}
$node_type = $route_match
->getParameter('node_type')
->get('type');
}
else {
$node_type = $node->type
->getString();
}
$gutenberg_enabled = $config
->get($node_type . '_enable_full');
if (!$gutenberg_enabled) {
return;
}
$suggestions = [
'node_edit_form__gutenberg',
];
}