Is there an easy way to get node's view mode from entity.view?

function classier_preprocess_views_view(&$vars) {

If you're trying to get the view mode of a node you probably want to use a different hook.

function classier_preprocess_node(&$vars) {
    $view_mode = $vars['view_mode'];

Should do the trick.

  • Yes, it is a good solution, but i need get view mode form view – dirkgntly Dec 5 '17 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.