Iframe Embed Attribute

The Iframe Embed attribute allows you to enter <iframe> code into a text box and have the full information about the iframe provided to the content template. 

Example Usage

An example usage could be to allow you to simply enter the iframe embed code for a Google Maps location but allow the developer to easily access the different parts of the embed code (namely the src) in the content template. They may need to do that to wrap the <iframe> with some custom HTML to make it responsive.  

If you enter the following code into the Iframe Embed field:

<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3021.7382211825034!2d-73.97402218433966!3d40.7677820421375!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c258f1fcd66869%3A0x65d72e84d91a3f14!2sCentral+Park+Zoo!5e0!3m2!1sen!2sus!4v1472657644721" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>

then the system will provide the following information to the content template:

Array
(
    [allowfullscreen] => allowfullscreen
    [frameborder] => 0
    [height] => 450
    [src] => https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3021.7382211825034!2d-73.97402218433966!3d40.7677820421375!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c258f1fcd66869%3A0x65d72e84d91a3f14!2sCentral+Park+Zoo!5e0!3m2!1sen!2sus!4v1472657644721
    [style] => border:0
    [tag] => <iframe allowfullscreen frameborder="0" height="450" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3021.7382211825034!2d-73.97402218433966!3d40.7677820421375!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c258f1fcd66869%3A0x65d72e84d91a3f14!2sCentral+Park+Zoo!5e0!3m2!1sen!2sus!4v1472657644721" style="border:0" width="600"></iframe>
    [width] => 600
)

The system uses a whitelist of <iframe> tag attributes to extract information from the <iframe> tag. For each attribute retrieved the attribute value and the full attribute are provided.

Only a single <iframe> tag is accepted. Anything other that that is ignored.

The returned data is an Iframe HTML Object. This means that you can easily add or change HTML tag attributes before outputting the iframe tag. 

{% set iframe.class = 'myClass' %}
{{ iframe.tag }}