Automatically extract attributes from pasted iframe embed codes

Created on 9 June 2022, over 2 years ago
Updated 24 August 2024, 3 months ago

Problem/Motivation

The iframe module is great for enforcing required attributes like title (for accessibility), width/height (for responsive scaling to maintain an aspect ratio) and many third-party websites that generate iframe embed codes may or may not include these attributes.

However it is complicated for non-technical web editors who want to just paste in an embed code. It takes extra time to separate out values like the "src" "width" and "height" from auto-generated iframe embed codes provided by third-party websites.

Proposed resolution

  1. Allow users to provide a single <iframe> embed code as an alternative to the "src" field as an initial step.
  2. Extract known attribute values (like "src", "width", "height", "frameborder", "class", etc) into the separate exposed sub-fields configured on the field widget.

Two approaches should be supported:

1. Client-side parsing and attribute extraction:

The iframe field could be a client-side generated dynamic/temporary field that is not saved server-side, but serves only to be able to display the original embed code pasted into the "src" field for reference and to extract attribute values from.

2. Server-side parsing and attribute extraction:

If an <iframe> embed code is entered into the src field and sent to the drupal php backend, then it should be automatically detected and valid attributes should be extracted into their respective fields during presave.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

3.0

Component

Miscellaneous

Created by

πŸ‡ͺπŸ‡¨Ecuador jwilson3

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024