Skip to content
Snippets Groups Projects
Commit f8349d30 authored by Joe Haskins's avatar Joe Haskins Committed by Bas Vredeling
Browse files

Issue #3170139 by jhaskins, smustgrave, basvredeling: Block names are...

Issue #3170139 by jhaskins, smustgrave, basvredeling: Block names are confusing when editing default layouts
parent 4007adc0
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,7 @@ CONFIGURATION
2. Select "Save".
3. Select on "Manage Layout".
4. Select on "Add Block" from somewhere in the layout builder.
5. The blocks will be named "Paragraph Item N".
5. The blocks will be named `{paragraph_bundle} item {delta} ({label})`.
### Using with Core Layout Builder per entity
......
......@@ -83,15 +83,14 @@ class ParagraphBlocksDeriver extends EntityDeriverBase {
}
$bundles = $field_info[$field_name]['bundles'];
foreach ($bundles as $bundle) {
for ($delta = 0; $delta < $cardinality; $delta++) {
$admin_label = $this->t('Paragraph item @delta', [
$bundle_field_definitions = $this->entityFieldManager->getFieldDefinitions($entity_type_id, $bundle);
$bundle_label = $bundle_field_definitions[$field_name]->getLabel();
$admin_label = $this->t('@bundle_label item @delta', [
'@delta' => $delta,
'@bundle_label' => $bundle_label,
]);
if (count($bundles) > 1) {
$bundle_field_definitions = $this->entityFieldManager->getFieldDefinitions($entity_type_id, $bundle);
$bundle_label = $bundle_field_definitions[$field_name]->getLabel();
$admin_label .= '(' . $bundle_label . ')';
}
$plugin_id = "$entity_type_id:$field_name:$delta:$bundle";
$this->derivatives[$plugin_id] = [
'context_definitions' => [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment