-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(dev/core#2994) IFrame Connector - Add extension to allow remote iframes (*incubation*) #29496
Conversation
__Background__: The `Civi::url()` helper takes logical URLs (`frontend://civicrm/event/info`) and translates to physical URLs. __Before__: The schemes are specifically `frontend://`, `backend://`, and `current://`. Logical schemes are only defined by `civicrm-core` and its UF-integrations. __After__: * Extensions can define new logical schemes. * The `http://` and `https://` schemes are also supported. __Technical Details__: * To add a new scheme, you implement event `civi.url.render.MYSCHEME`. The listener should translate the logical URL into a physical URL. * Since physical URLs will typically be HTTP(S), we add some more helpers that are convenient for outputing HTTP(S), as in: In particular, the `merge()` utility should help with this.
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
The `System::url()` API has a contract designed for a "two scheme world" (frontend or backend). The gist of the contract is this: - By default, the URL is rendered in the *current* environment (frontend xor backend) - You may optionally request a specific environment (`$frontend=TRUE` or `$forceBackend=TRUE`). We're entering a "multi-scheme" world (with frontend or backend; and also: web-service or oembed). This is more apparent in the `Civi::url()` API, where you can give a scheme (`current://` or `frontend://` or `oembed://`). But we still have many calls to `System::url()`. The patch preserves the behavior of `System::url()` for all normal work in the existing frontend/backend environments. But it adds support for other "current" environments: ==> If you're processing an oembed page-view and call `System::url()` (with default options), then it should return the oembed-style URL. Of course, if you give an explicit flag (`$frontend`, `$forceBackend`), then that will still be respected.
59b6695
to
55853cf
Compare
There's currently one test failure ( |
55853cf
to
d96b8aa
Compare
Yes I can confirm I have been able to generate a suitable iframe where d10 is the provider and a WP is consumer so far |
.gitignore
Outdated
@@ -22,6 +22,7 @@ | |||
!/ext/financialacls | |||
!/ext/contributioncancelactions | |||
!/ext/recaptcha | |||
!/ext/oembed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@totten it seems you have re-named the ext to be iframe but this is still set to be oembed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @seamuslee001. Fixed.
d96b8aa
to
fcc2036
Compare
Reviewed the code, tried out the functionality. Good to merge. |
Failures are a Leap Day Present. |
Every page in drupal 8 is now giving php warnings - followup PR: #29560 |
Overview
The humble
<iframe>
has been around since HTML 4, and it provides a widely-known mechanism to embed content from other web-sites. However, modern<iframe>
s are more complicated than their ancestors -- they require additional adaptations to operate with current browsers. And (at the CMS layer)<iframe>
support is often disabled by default.This PR provides opt-in support for
<iframe>
s for CiviCRM. By enabling the extension ("IFrame Connector"), one can allow external web-sites to embed CiviCRM pages.UF=Drupal
andUF=Drupal8
. But we need to develop similar connectors for other UFs, and we will probably revise the options further in the coming months. Therefore, it is hidden (<tag>mgmt:hidden</tag>
) from the main list of extensions.info.xml
have been cleaned up more. The extension has been renamed(oembed
=>iframe
) from earlier drafts.Before
After
Quick Start
Enable the extension via CLI/API:
The "System Status" will prompt you to deploy the connector script:
In "Administer > System Settings > IFrame Connector", you can configure how embedded pages will work:
Pick a public CiviCRM page (eg
civicrm/contribute/transact?reset=1&id=1
).On an external website, you can make an HTML page which embeds the CiviCRM page:
Comments
The included
ext/iframe/README.md
includes more, discussion, and list of TODOs.Why rename the extension? In retrospect, the current code is actually about IFRAMEs. IFRAMEs can be used with or without oEmbed. The follow-up will provide an
oembed
extension which is actually about oEmbed (i.e. the protocol for translating copy-pasted URLs into IFRAME snippets). Andoembed
will depend oniframe
.