Skip to content
Snippets Groups Projects

Update same_page_preview.module

1 unresolved thread
+ 8
1
@@ -19,7 +19,14 @@ function same_page_preview_preprocess_html(&$variables) {
$route_name = \Drupal::routeMatch()->getRouteName();
if ($route_name === 'entity.node.preview') {
unset($variables['page_top']['toolbar']);
// TODO - Needs additional cleanup to remove toolbar related classes on body.
// Additional cleanup to remove toolbar related classes on body.
if (isset($variables['attributes']['class']) && is_array($variables['attributes']['class']) && $variables['attributes']['class']) {
foreach ($variables['attributes']['class'] as $index => $class) {
if (strpos($class, 'toolbar') !== FALSE) {
unset($variables['attributes']['class'][$index]);
}
}
}
// Remove contextual links.
$variables["page"]["#attached"]["library"] = array_values(array_diff($variables["page"]["#attached"]["library"], ['contextual/drupal.contextual-links']));
}
Loading