-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EWPP-1300: Using the OE OEmbed component.
- Loading branch information
Showing
38 changed files
with
126 additions
and
2,849 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,15 @@ | ||
# OpenEuropa Media Embed module | ||
|
||
The OpenEuropa Media Embed module allows the embedding of Media entities into content in an agnostic (non-Drupal) way. | ||
The OpenEuropa Media Embed module integrates with OE OEmbed to provide a Media-based embed button. | ||
|
||
To this end, it comes with two main elements: the WYSIWYG embed button and the filter plugin. On top of that, it allows | ||
the site administrators to define which available view displays are also available to be embedded. | ||
This module serves as a BC legacy bridge between the old media-based embed button and the new | ||
generic one that has been moved to OE OEmbed. | ||
|
||
## WYSIWYG button | ||
# Dependencies | ||
|
||
Using the media embed WYSIWYG button, editors can select media entities that they wish to embed. Upon selecting the media entity, an oEmbed-based embed code is | ||
inserted in the content. This code follows the oEmbed protocol and is therefore understandable by other clients as well. An example embed code: | ||
This module depends on the OE OEmbed module so make sure you add it to your composer.json: | ||
|
||
``` | ||
<p data-oembed="https://oembed.ec.europa.eu?url=https%3A//data.ec.europa.eu/ewp/media/118a06e9-e7df-4b7b-8ab2-5f5addc2f0b3"> | ||
<a href="https://data.ec.europa.eu/ewp/media/118a06e9-e7df-4b7b-8ab2-5f5addc2f0b3">sdasd</a> | ||
</p> | ||
composer require openeuropa/oe_oembed | ||
``` | ||
|
||
Where `118a06e9-e7df-4b7b-8ab2-5f5addc2f0b3` is the UUID of the media entity. | ||
|
||
|
||
Moreover, we have the [OpenEuropa oEmbed component][1] which will be used when a site expects its content to be read by external systems that | ||
need to understand the embed codes. Essentially, it acts as an oEmbed provider for the media resources on the site. | ||
|
||
## Text filter | ||
|
||
The embed code provided by the WYSIWYG button is transformed into the rendered entity by the filter plugin `FilterMediaEmbed`. | ||
Adding this to a text format will replace the embed tags with the rendered media entity. | ||
|
||
|
||
## Embeddable view displays | ||
|
||
Site administrators will need to define which available view modes are also available to be embedded via the tools described above. | ||
This is done by selecting the available view displays on the display mode configuration page for each available media bundle. | ||
|
||
## Usage | ||
|
||
In order to use the functionalities of the module, follow the next steps: | ||
|
||
1) Create a text format. | ||
You can do so by navigating to `/admin/config/content/formats` and clicking the "Add text format button". More information | ||
is available on the official [documentation][2]. | ||
|
||
2) Add the Media Embed button to your Active toolbar. | ||
You can do that while creating your text format or by navigating to the text format configuration form (`/admin/config/content/formats/manage/TEXT_FORMAT_ID`). | ||
Make sure you select CKEditor as the Text editor for your text format and move the "Media" button from the *available buttons* section to the Active toolbar. | ||
|
||
3) Enable the "Embeds media entities using the oEmbed format" filter. | ||
This filter needs to be enabled and placed last in the Filter processing order. | ||
(**WARNING**: This is very important if you want the oEmbed specific urls to be converted into internal aliases) | ||
|
||
4) Make view displays embeddable. | ||
Once the previous steps are done, navigate to the display mode configuration of the bundle you wish to be embeddable and select which of | ||
the available view displays will be available for embedding. E.g., in order to configure which of the view displays of the Image media type | ||
are available for embedding, you will need to navigate to `/admin/structure/media/manage/image/display`. | ||
|
||
|
||
|
||
[1]: https://github.com/openeuropa/oe_oembed | ||
[2]: https://www.drupal.org/docs/user_guide/en/structure-text-format-config.html | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
modules/oe_media_embed/config/install/oe_media_embed.settings.yml
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
modules/oe_media_embed/config/schema/oe_media_embed.schema.yml
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes
This file was deleted.
Oops, something went wrong.
125 changes: 0 additions & 125 deletions
125
modules/oe_media_embed/js/plugins/embed_media/plugin.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ dependencies: | |
- media_avportal:media_avportal | ||
- embed:embed | ||
- drupal:ckeditor | ||
- oe_oembed:oe_oembed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Install functions for OpenEuropa Media Embed module. | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
use Drupal\embed\Entity\EmbedButton; | ||
|
||
/** | ||
* Implements hook_install(). | ||
*/ | ||
function oe_media_embed_install($is_syncing) { | ||
if ($is_syncing) { | ||
return; | ||
} | ||
|
||
// Set the icon onto the shipped embed button. | ||
/** @var \Drupal\embed\EmbedButtonInterface $button */ | ||
$button = EmbedButton::load('media'); | ||
$icon = EmbedButton::convertImageToEncodedData(drupal_get_path('module', 'oe_media_embed') . '/embed.png'); | ||
$button->set('icon', $icon); | ||
$button->save(); | ||
} |
Oops, something went wrong.