Hide/disable a subfield in "alignment" field (custom module)

Hi guys,

In a custom module, what should I do to hide/disable the CENTER option for the “type”: “alignment” field in fields.json file?

alignment.png

Meaning I’d like to see the LEFT and RIGHT option only.

I looked around for a hidden subfield but couldn’t find any. I assume it should be something like that:

{
 "label": "Position Image",
 "name": "img_position",
 "type": "alignment",
 "alignment_direction": "HORIZONTAL",
 "visibility": {
 "hidden_subfields": {
 "???": true
 }
 },
 "default": { "horizontal_align": "LEFT" }
}

Any ideas?

Hi @KeremKandirali ,

I’m not sure if this works the way you want it to, but I have an alternative for you here.

Try it here as in the example:

Left:

Right:

Best regards

Özcan

Thank you very much Özcan, yeah, it seems the only solution is using a choice field.

Hey @KeremKandirali ,
I thought about your problem again and look if the middle button could be hidden somehow. But I couldn’t find a solution, even addressing the classes didn’t help. But I think it would be a good idea to write that down here as an idea.
Best regards
Özcan