Conversation
|
Awesome. I will check it tomorrow |
|
This looks like a very complex solution given that media field can be complemented by an additional text field as is a already done in some components. The issue really only exists in the media custom field plugin and, IMO, should be fixed there. |
|
all seems ok to me - thanks. Some styling improvements but thats all I saw |
|
|
||
| <field | ||
| name="alt_text" | ||
| type="list" |
There was a problem hiding this comment.
As this is just a yes/no field then I would make it a switcher
|
@SharkyKZ Tthank you for your opinion But
@brianteeman I like your suggestion to convert the selection field into a switch. If my draft gets a little more approval I will definitely change it. |
Custom field plugins have the ability to modify form's DOM content. So it's possible to change the media field into a subform field that contains media field and text field for alt attribute. This would still require data type checks to handle but at least they'd be limited to wherever custom fields are used.
I don't necessarily disagree, but doing it this way is really messy. You need to account for both data types in every place its used. Currently this PR doesn't do that. The same thing would be needed by all 3rd party developers. It also seems wrong having to modify Some other solutions to consider: Modify media custom field plugin to use subform. Changes would be needed only in the custom field plugin and template overrides where fields are rendered manually. Introduce a new field (e.g. Introduce a new field and a new custom field plugin. Making use of alt text requires users to edit fields in their content anyways, so might as well go a little further and have users create new fields to make use of the feature. Final option, change data type only when the field is using alt text. This way existing extensions are not affected. |
|
I was thinking on the lines of a subform myself until I saw this proposal. I can't/won't comment on the code quality/complexity/maintainability of either approach as I am not qualified to do so |
Pull Request for Issue #27571 .
Summary of Changes
I have integrated the possibility to enter an alternative text for a media field. This PR is a draft because it affects many other components. I haven't checked them all yet. I would like to know your opinion first.
Testing Instructions
npm cior/andcomposer iare not necessary.mediain the content component. Chooseyesfor theAlternative text for imageoption andnofor the other.Perhaps we should consider doing this uniformly in the future via the media field.
Documentation Changes Required
https://docs.joomla.org/J3.x:Adding_custom_fields/Media_Field