Score:0

Modifying the alias of a field in a drupal 9 view

co flag

I have a small problem that I can't solve from the drupal 9 configuration.

When creating a view and adding a field to it, it is possible to create an alias to that field within its configuration. But it does not allow me to add a blank space to that alias, that is, it forces me to add a _ or some other character.

For example, I would like the alias to be: Term_name, but drupal forces me to be: Term_name or Term_name or some other form without spaces.

How could I add the alias with spaces? I mean, can I change it "bare-bones" somehow in the database, or by creating some hook?

Geat avatar
de flag
Could you explain your motivation behind needing to do this? In terms of field machine names, they can't contain spaces and there's nothing you can do to change that.
co flag
We are rebuilding a backend and the client needs these fields to contain spaces, as they are consumed in an API. Actually, it is not the machine name, but the alias that can be assigned to the field.
cn flag
I’ve checked a bunch of D9 Views and I don’t see anywhere to put in an alias - is this custom functionality? Or are you using a particular View display which makes it available?
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.