On February 5, 2021 . By CodimTh Category: Web Drupal How to get view mode of node in Drupal 8 & 9 Example How to get view mode of node in Drupal 8 & 9: function THEMENAME_preprocess_node(&$vars) { if(($node->getType() == 'article') && ($vars['view_mode'] == 'teaser')) { // TODO } } Tags : Drupal Tutorial Drupal Tips Drupal Previous PostUse configuration as cacheable dependencies in drupal 8 & 9Next PostHow to get image field with image style in Drupal 8 & 9 Comments Add new comment Your name Subject Comment About text formats Restricted HTML Leave this field blank
Comments