Expose MM pages as Entities

Created on 22 August 2014, over 10 years ago
Updated 30 May 2024, 7 months ago

In Drupal 7 and later, Entities are the central building block that makes up site. Many modules (such as Metatag β†’ ) add functionality by associating their additional data with entities. By exposing Monster Menus pages as [read-only] entities, such modules can associate data with pages by mmtid with no special modifications required to either the module or Monster Menus.

Our particular need is to use the Metatag module to add various meta-tags to Monster Menus pages irrespective of the nodes placed on those pages. By exposing Monster Menus pages as Entities, the Metatag module can add its editing forms to the MM page-editing screens, associate its data with mmtids, and clean up its data on MM page delete.

Attached are 3 patches which implement aspects of this feature:

monster_menus-mm_entities.patch
This first patch adds just the bare essentials needed to support accessing Monster Menus pages as "mm_page" entities. This feature is primarily contained in a new "mm_entities" sub-module with the some very minor additions to mm_api.inc, misc.inc, mm_content.inc, and mm_ui_content_edit.inc that allow the mm_entities module to hook in at appropriate places in the content edit, delete, and render phases.

monster_menus-mm_entities_with_fields.patch
This patch is identical to the former one, but with the addition of an admin form for adding Fields to "mm_page" entities.

This is not a feature we require at this time, but I can imagine that it could be quite useful -- allowing site administrators to dynamically create additional page data or metadata options for site editors to work with.

monster_menus-mm_metatags.patch
This patch adds an additional tiny submodule that provides the integration configuration so that the Metatag module will know about "mm_page" entities. This may not be of interest for inclusion in MM proper, but I'm attaching it so that the other features can be tested and evaluated.

The patches above are usable, however they haven't been tried with a wide variety of modules (just Metatag and adding fields to pages). I'm interested in feedback on this proposed feature both broadly and on particular implementation details.

Best,
Adam

✨ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States adamfranco

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024