Skip to content
Snippets Groups Projects
Commit 996376db authored by Steve Wirt's avatar Steve Wirt
Browse files

Issue #3357502: CMDocument: Add support for documenting base fields

parent d5298d37
Branches
Tags
No related merge requests found
......@@ -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;
}
}
}
......
......@@ -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;
......
......@@ -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');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment