Include an edit link in the table that lists fields

Created on 7 December 2023, 12 months ago
Updated 21 December 2023, 11 months ago

Problem/Motivation

We introduced a table that displays the configured fields for the entity type document being viewed in https://www.drupal.org/project/content_model_documentation/issues/3367101 ✨ CM Document for fieldable entities should show their fields Active .

The table should include a link to edit the fields for convenience when authoring CM Documents.

Steps to reproduce

  1. Author a CM Document for an entity that has fields configured.
  2. View the document and scroll to the table of fields and notice there is not a link to edit the field.

Proposed resolution

  1. Add a link to edit the field
  2. Only display the link if the current user has access to edit the field
  3. Include the edit link for all supported fieldable entity types
    1. Block
    2. Media
    3. Node
    4. Paragraph
    5. Taxonomy

User interface changes

A link to edit fields will be displayed.

✨ Feature request
Status

Fixed

Version

1.0

Component

Content model document

Created by

πŸ‡ΊπŸ‡ΈUnited States lexfunk

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

Comments & Activities

  • Issue created by @lexfunk
  • πŸ‡ΊπŸ‡ΈUnited States lexfunk
  • πŸ‡ΊπŸ‡ΈUnited States lexfunk

    Here is a first pass patch that works for nodes and paragraphs. I will follow up with a patch that supports the rest of the entity types.

  • πŸ‡ΊπŸ‡ΈUnited States lexfunk

    This patch actually works. The patch from #3 was attempting to call `$edit_link->toRenderable` and it wasn't necessary.

  • πŸ‡ΊπŸ‡ΈUnited States lexfunk

    Another patch that adds the destination parameter to the link so that when you save the any changes made to the field configuration you are returned to the cm doc.

  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    Thank you for the contribution @lexfunk I will try to get to reviewing this in the next couple days.

  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    Hi Lexfunk this is looking pretty good.
    Do we need to wrap the return in getFieldEditLink() with a check for the existence of $type_parameter_key?
    It looks like $type_parameter_key is only defined if it is a node or a paragraph due to the switch case. Maybe have in intentionally return NULL if $type_parameter_key is empty, so the return can specify Link|null ( rather than Link | void )

    • swirt β†’ committed f04f0f8b on 1.0.x
      Issue #3406751 by swirt: Include an edit link in the table that lists...
  • Status changed to Fixed 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    I committed your patch @lexfunk and then followed up with a couple minor changes

    1. CS cleanup
    2. moved the access check into the getFieldEditLink() method.
    3. Add the link to the table for sibling fields too.

    Thank you for all your work on this Lex. It is a really helpful feature.

    This if fixed and will go out with 1.0.24.

  • Status changed to Fixed 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    This has been released in 1.0.24

    If you add other content types, feel free to open a new issue. It is easier to track than adding them to this issue.

Production build 0.71.5 2024