Skip to content

Instantly share code, notes, and snippets.

@DejanBelic
Created February 25, 2017 07:03
Show Gist options
  • Save DejanBelic/c8a86edc4e4ce2cdc4f8e6dd83f78a66 to your computer and use it in GitHub Desktop.
Save DejanBelic/c8a86edc4e4ce2cdc4f8e6dd83f78a66 to your computer and use it in GitHub Desktop.
Add class to specific article in drupal 8.
function my_theme_preprocess_node(&$variables) {
if (($variables['elements']['#attributes']['data-history-node-id']) == 10) {
$variables['attributes']['class'][] = 'about-us-';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment