X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Flayout_builder%2Fsrc%2FPlugin%2FBlock%2FExtraFieldBlock.php;fp=web%2Fcore%2Fmodules%2Flayout_builder%2Fsrc%2FPlugin%2FBlock%2FExtraFieldBlock.php;h=6b991037687d4d9c9ae76afadad3a74a5e8aa602;hp=ddb7f01fd9bfa3047c57499b49e81486e1bfa316;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hpb=9424afc6c1f518c301bf87a23c047d1873435d05 diff --git a/web/core/modules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php b/web/core/modules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php index ddb7f01fd..6b9910376 100644 --- a/web/core/modules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php +++ b/web/core/modules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php @@ -130,13 +130,22 @@ class ExtraFieldBlock extends BlockBase implements ContextAwarePluginInterface, // render array. If the hook is invoked the placeholder will be // replaced. // @see ::replaceFieldPlaceholder() - '#markup' => new TranslatableMarkup('Placeholder for the "@field" field', ['@field' => $extra_fields['display'][$this->fieldName]['label']]), + '#markup' => $this->getPreviewFallbackString(), ]; } CacheableMetadata::createFromObject($this)->applyTo($build); return $build; } + /** + * {@inheritdoc} + */ + public function getPreviewFallbackString() { + $entity = $this->getEntity(); + $extra_fields = $this->entityFieldManager->getExtraFields($entity->getEntityTypeId(), $entity->bundle()); + return new TranslatableMarkup('Placeholder for the "@field" field', ['@field' => $extra_fields['display'][$this->fieldName]['label']]); + } + /** * Replaces all placeholders for a given field. *