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.
When editing a field of type "iframe" in admin/structure/types/manage/..., default values are not saved. So when creating a new node with a field of type "iframe", the default values are not used. I don't know if this is the same issue, but the configuration for the frameborder and scrolling attributes are ignored in nodes.
Comments
Comment #2
marcvangendAny news on this? I'm seeing the same thing: the frameborder is rendered even though I configured the field with "no frameborder". It looks like the configuration is stored correctly though, because in the field config yml (
field.field.paragraph.iframe.field_iframe.yml
in my case) it saysframeborder: '0'
. I wonder if IframeDefaultFormatter::iframe_iframe() is doing its job properly.Comment #3
marcvangendIndeed, the frameborder disappears when you change this...
...to this...
...around line 131 of iframe/src/Plugin/Field/FieldFormatter/IframeDefaultFormatter.php. I have no time to write a patch at the moment, but it looks like the module can use a bit of cleaning up.
Comment #4
neffets CreditAttribution: neffets commentedCan you verify that you mean the manage/ page?
Please try dev-version:
On my page "/admin/structure/types/manage/story/fields/node.story.field_iframe9" I can save and change the "frameborder", the scrolling", and so on. It remembers all changes and shows me the changed setting on reedit.
What is Your setting at:
* /admin/structure/types/manage/story/fields/node.story.field_iframe9
* and manage form display /admin/structure/types/manage/story/form-display on iframe-field behind "wheel"
Comment #5
marcvangendIn fact, I tested this on the
/admin/structure/types/manage/page/fields/node.page.field_iframe_test
page (node field configuration form), as well as the/admin/structure/paragraphs_type/iframe/fields/paragraph.iframe.field_iframe
page (paragraph field configuration form). Both behaved the same.I updated to the dev version (commit 11a5ae0) but that didn't solve the problem. The change described in #3 does work. I guess you always have to define
$options['frameborder']
, even if it is 0, to make sure the frameBorder attribute is set on the iframe element.I tested this with Drupal 8.2.6, in both Firefox and Chrome.
Comment #6
marcvangendIt turns out it's more complicated than I thought. When you change the frameborder field setting after content has been saved, the value of
$item->frameborder
remains the same. I guess that is what LpSolit meant when he wrote that the default value is not saved. (It is in fact saved, but not used.)I give up, I'll just use CSS instead.
Comment #7
rafaelcaceres CreditAttribution: rafaelcaceres at Taller commentedI confirm this. I can't apply a scrolling="no" to my ifram!
Comment #8
doxigo CreditAttribution: doxigo commentedThe same problem with Width and Height default values
Comment #9
ankithashettyFacing problems in saving default values like height, width here... Any idea how to fix this?
Comment #10
neffets CreditAttribution: neffets commentedtest again.
Comment #14
neffets CreditAttribution: neffets commentedAdded "massageFormValues()" function which acts as "presave" Function.
Problem was, that the user are only allowed to save some attributes (title, width, height)
The admin-values (frameborder, etc) are not saved and were not available to node-rendering of the iframe-field.
Now the user-values will be enhanced by the admin-values before saving.
Comment #15
neffets CreditAttribution: neffets commentedComment #16
neffets CreditAttribution: neffets commented