Clients often have a need for taking code from a third-party service and injecting
that into their site through embed codes. Tracking pixels, third-party forms, and
media assets are good examples of embeds that your clients might request for their
HTML tags, it can be difficult to manage the injection of these embeds at scale.
embeds all by themselves without requiring an administrator to approve each one.
The concept of Embed Templates is split into two parts: definitions and renderers.
An embed template entity can have an associated "type" that tells the module how to define the data structure of the embed that is then serialized for storage and rendered in the template file later.
Every embed type will share some common fields in order to allow users the ability to manage embeds from an administration screen. A label, path, and status will be attached to every embed entity, and your template variables will be serialized and
stored in a table with the other information. That's all the embed entity is: simple.
Each embed type then needs a way to render the serialized data that a user has entered. Since the key/value pairs are arbitrary, you could have the same forms and submission callbacks tied to multiple renderers. Each renderer will live in its own module so you can easily only add what you need for your specific use case.
Installing The Module
As every other Drupal module says, install this module as you normally would.
There are no external libraries to install and dependencies are kept as simple as
Several permissions are created for each embed type that you will have to assign to the proper user roles before you allow any users to create an embed entity.
You can find those permissions under "Embed Templates" on the user permissions
The overall administration screen for embeds is located at "admin/content/embeds"
on your Drupal site. From that screen you can add, edit, search for, and perform bulk operations on embeds.
Development and Extension
The main embed_templates module tries to provide as many helper functions as possible for you to add embed types and renderers with as little code as possible.
You should look through the functions in that module for help on how to query for the information you might need. There are several getter functions included.
As far as adding embed types to this module, only embed renderers will be considered for future additions. We don't want to have a million different services and templates included as sub-modules, but we do want to allow other developers to contribute shared functionality via common functions and additional renderers.
If you come up with an embed template for a popular service, please create a project
starting with the "embed_templates_" namespace and file an issue to be added to this readme as an extension. Once enough embed types are created, we will split them into categories, but for now, they will all be lumped together.
Related Embed Type Modules:
|7.x-1.0-beta4||tar.gz (30.36 KB) | zip (45.79 KB)||2017年10月11日||发布说明||简 | 繁 | 更多|
|7.x-1.x-dev||tar.gz (30.36 KB) | zip (45.83 KB)||2017年10月11日||发布说明||简 | 繁 | 更多|