Problem/Motivation

If I am looking at a CM document for a fieldable entity (nodes, taxonomy, paragraphs, menus...) I should see a list of the fields on that entity.

The list should be rendered as a table with these values: field name, field type, help text (description), edit link for users with permission.

Steps to reproduce

Currently, when viewing a CM document field configurations are not listed on the document.

Proposed resolution

Provide a computed field (field_fields_summary) that can be placed using the admin screen at admin/config/system/cm_document/display that renders field name, field type, help text for each field of the entity in a table.

Remaining tasks

  1. Add code to get field data for the documented entity
  2. Add code that provides "field_fields_summary" as a rendered table when viewing a CM document for a fieldable entity

User interface changes

Admin interface at admin/config/system/cm_document/display will have a new field, field_fields_summary, that can be placed in display modes.

API changes

None

Data model changes

A computed field called field_summary would be added to CM documents entities.

Comments

swirt created an issue. See original summary.

swirt’s picture

Issue summary: View changes
swirt’s picture

Title: CM Document for fieldable entities, should show their fields » CM Document for fieldable entities should show their fields
swirt’s picture

swirt’s picture

Component: Code » Content model document
lexfunk’s picture

Issue summary: View changes
lexfunk’s picture

Assigned: Unassigned » lexfunk
lexfunk’s picture

I updated the issue description with details about what I think this should be. Please provide any feedback if you want to see something different.

I assigned the issue to myself to work on over the coming days.

swirt’s picture

@lexfunk Those changes sound awesome. Thank you for taking this on. I think it will be a great improvement.

swirt’s picture

In the table, if you can add a link to existing a document if it exits (no link if it doesn't) that would make this also close #3367101: CM Document for fieldable entities should show their fields

I've been thinking we could use a Trait that has some helper functions like

getCmDocumentExists($entity, $bundle, $field=NULL)
getCmDocumentLink($entity, $bundle, $field=NULL)
Used for building the link to a CMDocument and then seeing if it exists. for cases where we need to build them.

swirt’s picture

I am going to clear the way for you by creating this trait this weekend #3389342: Create CMDocumentConnectTrait

swirt’s picture

I added the trait content_model_documentation/src/CMDocumentConnectorTrait.php

This should make it easy to get the link if a document exists.

  • swirt committed dae903ce on 1.0.x
    Issue #3367101 by swirt, lexfunk: CM Document for fieldable entities...
swirt’s picture

Status: Active » Fixed

I just added this, not as a computed field but in a bit more of a hard layout way as an "Add on" The reason, is that adding it as a field makes it harder to force it out to all existing installs.

Viewing any existent content model document for a fieldable entity, now shows a list of all fields on the entity.

swirt’s picture

The only acceptance criteria missing from this was showing an edit link. I will follow that up in a different issue as I want to roll it out systemically to all the other add-ons.

swirt’s picture

Status: Fixed » Closed (fixed)