[Week 9] Adding the embed functionality in wysiwyg editor
You must have already read my introduction blog post about the media module for Drupal 8 on which I was working on with Janez Urevc (slashrsm) and Tadej Baša (paranojik) under Google Summer Of Code 2016.
Last week I wrote a blog post about the three new media bundles which were added to the media module. Those bundles provided the functionality to add documents, tweets and instagram posts to the Drupal sites.
This is how the media library looked with the new media bundle entities
This week, I worked on the embed functionality in wysiwyg editor. Let’s get into more details.
Drupal 8 comes with wysiwyg editor called the CKEditor in the core. There are two contributed modules, Embed and Entity Embed, which allow users to create embed buttons for the editor. I created an embed button for embedding different types of media entities in the editor. Here is the pull request for the embed functionality.
Once the media module is enabled, one needs to enable the embed button in the editor:
1) Go to Configuration -> Content authoring ->Text formats and editors
and drag and drop the media button to the editor toolbar.
2) Check “Display embedded entities” in the enabled filter section.
3) Uncheck “Restrict images to this site” in the same section.
4) You’re done!
Here are few screenshots of how the embedding functionality currently looks:
We are working on the embedding functionality to make it even better and easier for users to use. Hopefully we’ll make it work out of the box without any additional configuration required by the user.
This week, after finishing the embedding functionality, I’ll work on the cropping functionality for the uploaded images. That’s the final major task of this module. Once that is done, I’ll have to fix bugs and write documentation for the module. Get ready people, the media module is coming soon!
I’ll post more updates next week! :)