Experimental project

This is a sandbox project, which contains experimental code for developer use only.

This was originally intended as a D7 port of the Entity Embed module for D8. However that project now has an official D7 port, so this is unrelated, and has been renamed to CKEntity.

NOTE: This means that existing installs will break. If you are already using this module, and you do not want to have to re-configure/export your buttons, you should keep your version static at commit 33e783299fddf9ca73dbf986fd210b6cc1d978b8

I have not followed the Entity Embed D7 progress, but presumably it is improving, better supported, and more widely used. So I would recommend giving that a try first.

This module allows you to:

  • Create any number of custom buttons for Ckeditor that can be used to embed entities
  • Configure what formatters or view modes will be used to display those entities, and give each possibility a custom name, that can be selected in a simple dropdown in Ckeditor

The idea behind this approach is: allow complex configuration for site builders, but keep the interface dead simple for content editors.

Installation

Download and install the module as normal.

This module requires the CKEditor rich text editor, including the Widgets plugin. This is NOT standard, FYI, but here is a link to build your own CKEditor, starting with standard + Widgets.

To integrate with Drupal, you need to use either WYSIWYG module (dev version!) or CKEditor module. So far this has only been tested with the dev version of WYSIWYG.

Optional: To use a Views-based entity selection browser instead of the standard autocomplete, you need to have Entity Picker installed.

Optional: For a more user-friendly icon-picker, download and install: Jipi

Configuration

Go to /admin/config/content/entity-embed

Click "Add button" to create a new button.

In the button configuration page, choose an entity type, and an entity selection mode. If you choose "Autocomplete" as the entity selection mode, you can also (optionally) limit the autocomplete to certain bundles. If you have Entity Picker enabled you can alternatively use a View as the selection mode. Finally, create one or more "Formatter options". These are display options that content editors will see in the CKEditor dialog.

After saving the button, go to your CKeditor configuration page (for WYSIWYG module, you can get there from /admin/config/content/wysiwyg). The button should show up in the list of available buttons. Check it and save.

In your text format settings (/admin/config/content/formats) check "Display embedded entities" and save.

Usage

In CKEditor, position the cursor and click the toolbar button. Select an entity by typing in the title and selecting the autocomplete results (or if you choose the Views-based entity selection, click "Browse" and select the entity from the popup.) Choose a "formatter" if necessary, and an alignment option, as needed. Click OK.

To edit an existing entity, either double-click on it or right click and choose "Edit Entity" from the context menu.

Todo

  • Find/make non-crappy icons
  • Optimize with some caching
  • What can we do about security/access
  • Provide some default buttons
  • General testing

Project information