I need to write a views field plugin, where I need to display a message depending on if the render language exists for an entity. (i.e. entity languages: en, hu, fr display language: de -> message needs to show up, i.e. entity language: en, hu, fr display language: en -> no message) But for this, I can't get the language from the views. I can get the settings with $this->view->display_handler->getOption('rendering_language') but this can contain also dynamic values like ***LANGUAGE_entity_translation*** or ***LANGUAGE_entity_default***. I looking for a solution that can give me a specific language code that was made by the rendering language setting.

  • This is a rather complex question because there are so many ways to configure languages in Views. Your best chance is the row property node_field_data_langcode. See drupal.stackexchange.com/questions/283627/…
    – 4uk4
    Aug 27, 2020 at 7:44
  • That's not correct for me, because I need to align to the views settings, not a constant setting form the node itself. I can't believe that views don't have a function or property for this somewhere deep in the forest. Aug 27, 2020 at 13:11


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.