Small snippet to add bootstrap button to teaser in drupal 8
In the theme file. Add this function:
/** * Implements template_preprocess_links() */ function THEME_NAME_preprocess_links(&$variables) { $variables['links']['node-readmore']['link']['#options']['attributes']['class'][] = 'btn btn-primary'; $variables['links']['comment-add']['link']['#options']['attributes']['class'][] = 'btn btn-primary'; }
Then clear cache & refresh main page.
Similar Posts:
- How to add class to content field link in Drupal 8 / 9
- How to get view mode of node in Drupal 8 & 9
- How to remove title block for a certain page in Drupal 8
- How to remove title block for a certain page in Drupal 8
- Drupal: Creating a Computed Entity Field
660