Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SectionComponent.php

function SectionComponent::toRenderArray

Returns the renderable array for this component.

Parameters

\Drupal\Core\Plugin\Context\ContextInterface[] $contexts: An array of available contexts.

bool $in_preview: TRUE if the component is being previewed, FALSE otherwise.

Return value

array A renderable array representing the content of the component.

File

core/modules/layout_builder/src/SectionComponent.php, line 88

Class

SectionComponent
Provides a value object for a section component.

Namespace

Drupal\layout_builder

Code

public function toRenderArray(array $contexts = [], $in_preview = FALSE) {
    $event = new SectionComponentBuildRenderArrayEvent($this, $contexts, $in_preview);
    $this->eventDispatcher()
        ->dispatch($event, LayoutBuilderEvents::SECTION_COMPONENT_BUILD_RENDER_ARRAY);
    $output = $event->getBuild();
    $event->getCacheableMetadata()
        ->applyTo($output);
    return $output;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal