In advance, I am not a coder so bear with me.

I am trying to embed a map into a page. iframe code is:

I installed and enabled this module and added it to the page basic page content type. Text format is Full HTML.

When editing the page I see the new iframe fields.
I enter:
https://www.govtrack.us/congress/members/embed/mapframe?state=ca&distric...
into the iframe URL field
I enter:
425 and 300 into the respective width and hight fields. (Also tried % values as module page seems to indicate is allowed.)

Error reported back in red is "iframes need fix width and height, only numbers are allowed"

I've tried various numeric values.

What am I doing wrong?

Thanks

CommentFileSizeAuthor
#4 iframe-fix_validators-2842758.diff1.23 KBlpsolit

Comments

ehamburg created an issue. See original summary.

lilDrup’s picture

Hi,

I have the same issue with iframe module. Do you found a way to resolve it?

Thanks

ehamburg’s picture

I have not resolved the issue and have heard nothing back from the module maintainers.

I've actually moved the website this was for to another CMS. At this point Drupal 8.x for me is not a good fit for what I need and part of the reason is that module support for it is not where I need it to be.

lpsolit’s picture

Title: iframes need fix width and height, only numbers are allowed. » validateWidth() incorrectly rejects all values
Component: Miscellaneous » Code
Assigned: Unassigned » lpsolit
Category: Support request » Bug report
Priority: Normal » Major
Status: Active » Needs review
StatusFileSize
new1.23 KB

The problem is in validateWidth() where

if (!empty($me['width']) || preg_match('#^(\d+\%?|auto)$#', $me['width']))

should be

if (empty($me['width']) || !preg_match('#^(\d+\%?|auto)$#', $me['width']))

Note the wrong position of the ! operator.

I also fixed the regular expression used in validateHeight() to match the one used in validateWidth(), for consistency. I didn't fix the incorrect description which says that only fixed values are allowed. Now relative values (percentages) are also allowed, but this string appears too many times in IframeWidgetBase.php. Maybe it should be refactored a bit to avoid string duplication. :)

  • 30695ac committed on 8.x-1.x
    Issue #2842758 by ehamburg, patch by LpSolit: validateWidth()...
neffets’s picture

Status: Needs review » Fixed

Fixed error in validateWidth
I took the translation-proposal by LpSolit into mind and reorganized it (now only two occurences remains).

Status: Fixed » Closed (fixed)

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