Tôi muốn thay đổi chế độ xem của nút theo chương trình. Tôi đã sử dụng hook_preprocess_node(&$vars)và đặt chế độ xem:
function moduleName_preprocess_node(&$vars) {
      // if conditions to apply particular view mode
      $vars['view_mode'] = 'teaser';
      $vars['elements']['#view_mode'] = 'teaser';
}
Nhưng điều này không hoạt động như mong đợi. Am i thiếu cái gì ở đây?
                  Bạn đã thử xem lại điều này? drupal.org/node/1334206
                
                
                  
                    —
                    chrisjlee