The RemoteImageWidget does not respect the configuration of the field and request the title and the alt fields, even when they are disabled.

The widget does not respect the required configuration neither.

Comments

tucho created an issue. See original summary.

tucho’s picture

Status: Active » Needs review
StatusFileSize
new17.79 KB

What 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.

gaurav.kapoor’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Wooh! That's a major rewrite. TYSM. Will be working on this issue further and push all the relevant code from the patch file.

  • gaurav.kapoor committed f68225f on 8.x-1.x authored by tucho
    Issue #2987329 by tucho, gaurav.kapoor: RemoteImageWidget does not...
gaurav.kapoor’s picture

Status: Needs work » Fixed

Thanks, @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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.