Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
content_model_documentation
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
content_model_documentation
Commits
996376db
Commit
996376db
authored
1 year ago
by
Steve Wirt
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3357502
: CMDocument: Add support for documenting base fields
parent
d5298d37
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/DocumentableEntityProvider.php
+5
-0
5 additions, 0 deletions
src/DocumentableEntityProvider.php
src/Entity/CMDocument.php
+5
-0
5 additions, 0 deletions
src/Entity/CMDocument.php
src/Form/CMDocumentForm.php
+6
-0
6 additions, 0 deletions
src/Form/CMDocumentForm.php
with
16 additions
and
0 deletions
src/DocumentableEntityProvider.php
+
5
−
0
View file @
996376db
...
...
@@ -231,6 +231,11 @@ class DocumentableEntityProvider extends ServiceProviderBase {
}
foreach
(
$element
[
'bundles'
]
as
$bundle_name
)
{
$documentable_entities
[
"
{
$entity_type
}
.
{
$bundle_name
}
.
{
$element_name
}
"
]
=
"
{
$entity_type
}
.
{
$bundle_name
}
.
{
$element_name
}
"
;
// Add base field if it has not already been added.
$base_field_name
=
"base.field.
{
$element_name
}
"
;
if
(
!
isset
(
$documentable_entities
[
$base_field_name
]))
{
$documentable_entities
[
$base_field_name
]
=
$base_field_name
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/Entity/CMDocument.php
+
5
−
0
View file @
996376db
...
...
@@ -402,6 +402,11 @@ class CMDocument extends EditorialContentEntityBase implements CMDocumentInterfa
$field
=
$this
->
getDocumentedEntityParameter
(
'field'
);
switch
(
$type
)
{
case
'base'
:
// Field bases don't have an admin path, so path it to CM Document.
$alias
=
"/admin/structure/cm_document/
{
$type
}
/
{
$bundle_hyphenated
}
/
{
$field
}
"
;
break
;
case
'block_content'
:
$alias
=
"/admin/structure/block/block-content/manage/
{
$bundle
}
/fields/block_content.
{
$bundle
}
.
{
$field
}
/document"
;
break
;
...
...
This diff is collapsed.
Click to expand it.
src/Form/CMDocumentForm.php
+
6
−
0
View file @
996376db
...
...
@@ -210,6 +210,12 @@ class CMDocumentForm extends ContentEntityForm {
$module
=
$document
->
getDocumentedEntityParameter
(
'module'
);
return
(
$project
===
$module
)
?
"Module:
{
$project
}
"
:
"Module:
{
$project
}
:
{
$module
}
"
;
}
elseif
(
$entity_type
===
'base'
)
{
// This is a base field and has no name by itself.
$fieldname
=
$document
->
getDocumentedEntityParameter
(
'field'
);
return
"Base field:
{
$fieldname
}
"
;
}
else
{
// This is a real entity.
$bundlename
=
$document
->
getDocumentedEntityParameter
(
'bundle'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment