Loading custom_elements.module +1 −1 Original line number Diff line number Diff line Loading @@ -145,7 +145,7 @@ function custom_elements_prepare_slots_as_vue_3(CustomElement $custom_element) { */ function custom_elements_entity_type_alter(array &$entity_types) { // Use the right class depending on layout builder being used. $class = class_exists(LayoutBuilderEntityViewDisplay::class) ? CustomElementsLayoutBuilderEntityViewDisplay::class : CustomElementsEntityViewDisplay::class; $class = \Drupal::moduleHandler()->moduleExists('layout_builder') ? CustomElementsLayoutBuilderEntityViewDisplay::class : CustomElementsEntityViewDisplay::class; /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */ $entity_types['entity_view_display'] ->setClass($class); Loading src/CustomElementsLayoutBuilderEntityViewDisplay.php +1 −0 Original line number Diff line number Diff line Loading @@ -51,4 +51,5 @@ class CustomElementsLayoutBuilderEntityViewDisplay extends LayoutBuilderEntityVi return $this->buildSections($entity); } } } src/Processor/DefaultContentEntityProcessor.php +10 −8 Original line number Diff line number Diff line <?php namespace Drupal\custom_elements\Processor; use Drupal\Core\Entity\ContentEntityInterface; Loading @@ -12,7 +11,6 @@ use Drupal\Core\Render\Element; use Drupal\custom_elements\CustomElement; use Drupal\custom_elements\CustomElementGeneratorTrait; use Drupal\custom_elements\CustomElementsLayoutBuilderEntityViewDisplay; use Drupal\views\Plugin\views\field\Custom; use Symfony\Component\HttpFoundation\RequestStack; /** Loading Loading @@ -82,7 +80,7 @@ class DefaultContentEntityProcessor implements CustomElementProcessorInterface { /** * {@inheritdoc} */ public function addtoElement($data, CustomElement $custom_element, $viewMode) { public function addtoElement($data, CustomElement $element, $viewMode) { assert($data instanceof ContentEntityInterface); $entity = $data; Loading @@ -92,12 +90,16 @@ class DefaultContentEntityProcessor implements CustomElementProcessorInterface { if ($display->getThirdPartySetting('layout_builder', 'enabled')) { // Skip processing of the fields and let the layout builder render it all. $this->addLayoutBuilderContent($entity, $custom_element, $display); $this->addLayoutBuilderContent($entity, $element, $display); } else { foreach ($display->getComponents() as $field_name => $options) { if (isset($entity->{$field_name})) { $this->getCustomElementGenerator()->process($entity->get($field_name), $custom_element, $viewMode); if ($entity->hasField($field_name)) { $access = $entity->get($field_name)->access('view', NULL, TRUE); $element->addCacheableDependency($access); if ($access->isAllowed()) { $this->getCustomElementGenerator()->process($entity->get($field_name), $element, $viewMode); } } } } Loading Loading @@ -147,7 +149,7 @@ class DefaultContentEntityProcessor implements CustomElementProcessorInterface { * @param \Drupal\custom_elements\CustomElement $parent_element * The parent custom element to which content will be added. * * @return CustomElement[] * @return \Drupal\custom_elements\CustomElement[] * The list of generated custom elements. */ protected function getElementsFromBlockContentRenderArray(array $build, CustomElement $parent_element) { Loading src/Processor/DefaultFieldItemProcessor.php +0 −2 Original line number Diff line number Diff line <?php namespace Drupal\custom_elements\Processor; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException; use Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface; use Drupal\Core\Field\FieldItemInterface; Loading src/Processor/FileReferenceFieldItemListProcessor.php +0 −1 Original line number Diff line number Diff line <?php namespace Drupal\custom_elements\Processor; use Drupal\Core\Field\FieldItemListInterface; Loading Loading
custom_elements.module +1 −1 Original line number Diff line number Diff line Loading @@ -145,7 +145,7 @@ function custom_elements_prepare_slots_as_vue_3(CustomElement $custom_element) { */ function custom_elements_entity_type_alter(array &$entity_types) { // Use the right class depending on layout builder being used. $class = class_exists(LayoutBuilderEntityViewDisplay::class) ? CustomElementsLayoutBuilderEntityViewDisplay::class : CustomElementsEntityViewDisplay::class; $class = \Drupal::moduleHandler()->moduleExists('layout_builder') ? CustomElementsLayoutBuilderEntityViewDisplay::class : CustomElementsEntityViewDisplay::class; /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */ $entity_types['entity_view_display'] ->setClass($class); Loading
src/CustomElementsLayoutBuilderEntityViewDisplay.php +1 −0 Original line number Diff line number Diff line Loading @@ -51,4 +51,5 @@ class CustomElementsLayoutBuilderEntityViewDisplay extends LayoutBuilderEntityVi return $this->buildSections($entity); } } }
src/Processor/DefaultContentEntityProcessor.php +10 −8 Original line number Diff line number Diff line <?php namespace Drupal\custom_elements\Processor; use Drupal\Core\Entity\ContentEntityInterface; Loading @@ -12,7 +11,6 @@ use Drupal\Core\Render\Element; use Drupal\custom_elements\CustomElement; use Drupal\custom_elements\CustomElementGeneratorTrait; use Drupal\custom_elements\CustomElementsLayoutBuilderEntityViewDisplay; use Drupal\views\Plugin\views\field\Custom; use Symfony\Component\HttpFoundation\RequestStack; /** Loading Loading @@ -82,7 +80,7 @@ class DefaultContentEntityProcessor implements CustomElementProcessorInterface { /** * {@inheritdoc} */ public function addtoElement($data, CustomElement $custom_element, $viewMode) { public function addtoElement($data, CustomElement $element, $viewMode) { assert($data instanceof ContentEntityInterface); $entity = $data; Loading @@ -92,12 +90,16 @@ class DefaultContentEntityProcessor implements CustomElementProcessorInterface { if ($display->getThirdPartySetting('layout_builder', 'enabled')) { // Skip processing of the fields and let the layout builder render it all. $this->addLayoutBuilderContent($entity, $custom_element, $display); $this->addLayoutBuilderContent($entity, $element, $display); } else { foreach ($display->getComponents() as $field_name => $options) { if (isset($entity->{$field_name})) { $this->getCustomElementGenerator()->process($entity->get($field_name), $custom_element, $viewMode); if ($entity->hasField($field_name)) { $access = $entity->get($field_name)->access('view', NULL, TRUE); $element->addCacheableDependency($access); if ($access->isAllowed()) { $this->getCustomElementGenerator()->process($entity->get($field_name), $element, $viewMode); } } } } Loading Loading @@ -147,7 +149,7 @@ class DefaultContentEntityProcessor implements CustomElementProcessorInterface { * @param \Drupal\custom_elements\CustomElement $parent_element * The parent custom element to which content will be added. * * @return CustomElement[] * @return \Drupal\custom_elements\CustomElement[] * The list of generated custom elements. */ protected function getElementsFromBlockContentRenderArray(array $build, CustomElement $parent_element) { Loading
src/Processor/DefaultFieldItemProcessor.php +0 −2 Original line number Diff line number Diff line <?php namespace Drupal\custom_elements\Processor; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException; use Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface; use Drupal\Core\Field\FieldItemInterface; Loading
src/Processor/FileReferenceFieldItemListProcessor.php +0 −1 Original line number Diff line number Diff line <?php namespace Drupal\custom_elements\Processor; use Drupal\Core\Field\FieldItemListInterface; Loading