Add preprocess hook to add layout link to Inline entity form

Created on 31 January 2025, 7 months ago

Problem/Motivation

If you are adding a node that is setup with mercury editor through an inline entity form it would be good if there was a link that took you directly to the mercury editor edit page for that entity.
If the primary method for adding content to an entity setup with mercury editor is through mercury editor itself, than it is presumably not feasible to edit that content inline, instead provide a link directly to the mercury editor page for that piece of content.

This hook is triggered when there is a table of entities in your inline entity form, it won't be triggered or added where there is only a single entity per inline entity form.

A future enhancement for this work would be to provide a configurable option to add this button to the inline entity form table, rather than have it be added automatically.

Proposed resolution

Apply the patch attached to this issue.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇺🇸United States devanbicher

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

Comments & Activities

  • Issue created by @devanbicher
  • 🇺🇸United States devanbicher

    Patch to add this requested functionality.

  • 🇺🇸United States jrockowitz Brooklyn, NY

    I think we need to create a MercuryEditorTasksInlineEntityForm service for just the preprocess hook.

  • First commit to issue fork.
  • @immaculatexavier opened merge request.
  • 🇺🇸United States devanbicher

    Here are the steps to setup a site to expose this functionality

    1. Enable mercury editor and inline entity form
    2. Add a new content type
    3. Add a layout paragraphs field
    4. Enable that content type with mercury editor
    5. Create a paragraph
    6. In that paragraph, add a content reference field that references nodes
    7. Have its reference use the content type you created above, save
    8. Edit the new paragraphs' form mode
    9. For the content reference field in this paragraph change the form mode to 'Inline entity form - complex'
    10. Go back to your content type and add this paragraph to the layout paragraphs field
    11. Create a new piece of content (of the type you created in step 3)
    12. You just need to title it, you don't need to add any other content, save
    13. Create another piece of content of the same type
    14. Edit the layout of that new piece of content
    15. Add a paragraph of the type you created in step 6
    16. In the content reference field of this paragraph, select 'add an existing node'
    17. Search for the piece of content you created in step 12 (it should probably be the only one in the list) and select it
    18. After the entity select modal goes away there should now be another button after 'edit' that says 'Layout'
    19. That 'layout' button in the inline entity form is what this patch adds.
Production build 0.71.5 2024