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
- Add code to get field data for the documented entity
- 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
Comment #2
swirtComment #3
swirtComment #4
swirtThis issue if handled correctly could also close this issue #3357504: Make Documented parent show any documented children
Comment #5
swirtComment #6
swirtComment #7
lexfunk commentedComment #8
lexfunk commentedComment #9
lexfunk commentedI 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.
Comment #10
swirt@lexfunk Those changes sound awesome. Thank you for taking this on. I think it will be a great improvement.
Comment #11
swirtIn 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.
Comment #12
swirtI am going to clear the way for you by creating this trait this weekend #3389342: Create CMDocumentConnectTrait
Comment #13
swirtI added the trait content_model_documentation/src/CMDocumentConnectorTrait.php
This should make it easy to get the link if a document exists.
Comment #15
swirtI 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.
Comment #16
swirtThe 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.
Comment #17
swirtThis was just released https://www.drupal.org/project/content_model_documentation/releases/1.0.22