Closed (fixed)
Project:
Remote image
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 Jul 2018 at 22:57 UTC
Updated:
22 Dec 2021 at 12:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
tuchoWhat started as a small adjustment in two fields of the form element, ended up as a rather large change in the code base.
In the following lines I describe the changes that the attached patch would make.
First of all, a schema.yml file was added. It contains the definitions for the field settings, the widget and the field value.
I use the schema.yml file of the links module as base, since the remote_image module extends the functionality of that field.
I also use the concepts of the links module for adding the validation of the subelements when the field is required.
A few practical examples of the validations:
* If the field is required and the alt is optional, the validation won't fail if the alt is empty.
* If the field is required and the alt is required, the validation will fail if the alt is empty.
* If the alt has a value, the URL will be required. This works the same way for the rest of the subelements.
Finally, I added a hook_update, which migrates the existing field settings to the new keys alt_attribute and title_attribute.
Comment #3
gaurav.kapoor commentedWooh! That's a major rewrite. TYSM. Will be working on this issue further and push all the relevant code from the patch file.
Comment #5
gaurav.kapoor commentedThanks, @tucho for almost rewriting the module. I have ported the patch to the latest release, fixed a few undefined function calls, and tested the module completely. The work on making alt field required is really great.