Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
On creating an iframe field, and set to not be required, the width and height fields are shown as required and will not allow you to submit the entities form without entering a value
Comment | File | Size | Author |
---|---|---|---|
#3 | iframe-width-height-issues-2748283-1.patch | 875 bytes | pareshpatel |
Comments
Comment #2
pareshpatel CreditAttribution: pareshpatel as a volunteer and at Cybage Software Pvt Ltd. commentedComment #3
pareshpatel CreditAttribution: pareshpatel as a volunteer and at Cybage Software Pvt Ltd. commentedI have removed the required from Width and Height fields.
Please find the attached patch.
Comment #4
iancawthorne CreditAttribution: iancawthorne commentedThanks for the patch @pareshpatel. I've tested it and it looks ok to me.
Comment #6
neffets CreditAttribution: neffets as a volunteer commentedHmhm?
A iframe needs a width and a height. So its finally required for ever.
But YES, if we choose Manage-Form-Display for iframe to "URL with height" it
* should show only the URL and height field to the normal editor
* but have not to require the editor to give an width, because its not possible to give.
I bugfixed: If You choose some default values for width and height at Manage-Form-Display (work-symbol right to iframe), then now it will be used for the single story as default values.
These values will now be default for not shown fields (depending from the choosen Widget-Type)
==> I will not take the global patch to require nothing. But I fixed it in IframeUrlheightWidget.php and IframeUrlWidget.php, to preserve the default values for not-shown-fields AND that they are not required in case that the admin forgot to fill in default-values in Manage-Form-Display
// /admin/structure/types/manage/story/form-display
FIXED in 8.x-1.5
Comment #7
neffets CreditAttribution: neffets as a volunteer commentedComment #8
iancawthorne CreditAttribution: iancawthorne commentedSorry, but I think there is some confusion @neffets, this is not related to width and height being required for an iframe - that is absolutely correct, but not what the issue is.
If I create an iframe field on a content type, set it to not be required, it should be optional to choose to populate that field when creating a node... so if I create a node that does not have an iframe value, I'm unable to submit the form without specifying width and height values for a non existent iframe.
I would expect the width and height fields to only fail form validation if the iframe url is populated?
I've checked this in the 8.x-1.5 and that is still the case.
Comment #11
neffets CreditAttribution: neffets as a volunteer commented* Removed the requireness for width/height from IframeWidgetBase.php for authors view of node-edit.
* Added Validator, which check the value (number or number+"%")
* Validates width/height only if provided by form.