You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In recent client work, a scenario occured in which we wanted embeds in stream fields for all but one provider to have the "responsive-object" class and padding-bottom added, as enabled by the WAGTAILEMBEDS_RESPONSIVE_HTML setting. We ended up providing a /wagtailembeds/embed_frontend.html template and handling the additional logic in a template tag, but I would have liked to have been able to customise the Embed.is_responsive property to avoid working with the template at all.
I think it's worth discussing how the embed handling could be changed to make customisation easier. I appreciate this may be a niche use case so I'd like to hear the community and core team's thoughts.
A solution that could work would be to:
move the core Embed fields and methods to a new AbstractEmbed class;
provide a default Embed class that extends AbstractEmbed for backwards compatibility;
add a WAGTAILEMBEDS_EMBED_MODEL setting, so developers can use their own model that extends AbstractEmbed; and
update documentation accordingly.
Let me know what you think - if the idea has legs I'll get a PR together.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In recent client work, a scenario occured in which we wanted embeds in stream fields for all but one provider to have the "responsive-object" class and padding-bottom added, as enabled by the
WAGTAILEMBEDS_RESPONSIVE_HTML
setting. We ended up providing a/wagtailembeds/embed_frontend.html
template and handling the additional logic in a template tag, but I would have liked to have been able to customise theEmbed.is_responsive
property to avoid working with the template at all.I think it's worth discussing how the embed handling could be changed to make customisation easier. I appreciate this may be a niche use case so I'd like to hear the community and core team's thoughts.
A solution that could work would be to:
Embed
fields and methods to a newAbstractEmbed
class;Embed
class that extendsAbstractEmbed
for backwards compatibility;WAGTAILEMBEDS_EMBED_MODEL
setting, so developers can use their own model that extendsAbstractEmbed
; andLet me know what you think - if the idea has legs I'll get a PR together.
Beta Was this translation helpful? Give feedback.
All reactions