Score:1

How to make view display plugin translatable?

jp flag

I have a custom view display plugin which extends from the block plugin. When I add a display on the view, the fields or anything in the display is not translatable (see image below) enter image description here

How can I make the fields in the view display plugin translatable?

Score:1
cn flag

You need to define a schema (where products_block is the plugin ID):

/config/schema/mymodule.views.schema.yml

views.display.products_block:
  type: views.display.block
  label: 'Products block display options'
  mapping:
    ...

This extends views.display.block of /core/modules/views/config/schema/views.display.schema.yml, which extends views_display of /core/modules/views/config/schema/views.data_types.schema.yml

More info Block configuration form values are not translated?

Ivan Ginovski avatar
jp flag
Thanks @4k4 , that worked! One small adjustment I made: the file should be named mymodule.views.schema.yml
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.