- Issue created by @Ok4p1
- 🇪🇸Spain gxleano Cáceres
Hi Ok4p1,
We have updated Tagify form element in 1.2.18, see: https://www.drupal.org/project/tagify/issues/3411891 ✨ Add support for custom form-element supporting entity_reference Needs review
So, if you want to use the latest version, you might update your custom form elements.
- 🇪🇸Spain gxleano Cáceres
BTW,
#default_value
should be an array of entities, you could check an example from the latest version here: https://www.drupal.org/project/tagify/issues/3411891#comment-15588899 ✨ Add support for custom form-element supporting entity_reference Needs review - 🇬🇧United Kingdom Ok4p1 Glasgow
Hello, thank you for getting back to me. The part I don't get is that this is not a custom element, it is just an entity reference referencing a taxonomy term. Shouldn't that work out-of-the-box without having to customize it, like it did on 1.2.11?
I tried with 1.2.18 and the issue is still there.
- 🇪🇸Spain gxleano Cáceres
Thanks for the reply, now it is clearer.
Could you paste here the error that you are getting, please?
- Status changed to Closed: cannot reproduce
5 months ago 9:03am 23 June 2024 - 🇬🇧United Kingdom Ok4p1 Glasgow
Apologies, I wasn't able to replicate it either on a clean install, so it must be something about my codebase :(
- 🇬🇧United Kingdom Ok4p1 Glasgow
If anyone else faces this issue, my problem was the syntax used to disable the field programmatically so users could not change the default value (something that worked with 1.2.11).
Breaks: $form['field_page_type']['widget']['#attributes'] = ['disabled' => 'disabled'];
Works: $form['field_page_type']['widget']['#attributes']['disabled'] = 'disabled'; - First commit to issue fork.