class FieldLayoutBuilder implements ContainerInjectionInterface (View source)

Builds a field layout.

Properties

protected LayoutPluginManagerInterface $layoutPluginManager

The layout plugin manager.

protected EntityFieldManagerInterface $entityFieldManager

The entity field manager.

Methods

__construct(LayoutPluginManagerInterface $layout_plugin_manager, EntityFieldManagerInterface $entity_field_manager)

Constructs a new FieldLayoutBuilder.

static 
create(ContainerInterface $container)

Instantiates a new instance of this class.

buildView(array $build, EntityDisplayWithLayoutInterface $display)

Applies the layout to an entity build.

buildForm(array $build, EntityDisplayWithLayoutInterface $display)

Applies the layout to an entity form.

array
getFields(array $build, EntityDisplayWithLayoutInterface $display, string $display_context)

Gets the fields that need to be processed.

Details

__construct(LayoutPluginManagerInterface $layout_plugin_manager, EntityFieldManagerInterface $entity_field_manager)

Constructs a new FieldLayoutBuilder.

Parameters

LayoutPluginManagerInterface $layout_plugin_manager

The layout plugin manager.

EntityFieldManagerInterface $entity_field_manager

The entity field manager.

static create(ContainerInterface $container)

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

ContainerInterface $container

The service container this instance should use.

buildView(array $build, EntityDisplayWithLayoutInterface $display)

Applies the layout to an entity build.

Parameters

array $build

A renderable array representing the entity content or form.

EntityDisplayWithLayoutInterface $display

The entity display holding the display options configured for the entity components.

buildForm(array $build, EntityDisplayWithLayoutInterface $display)

Applies the layout to an entity form.

Parameters

array $build

A renderable array representing the entity content or form.

EntityDisplayWithLayoutInterface $display

The entity display holding the display options configured for the entity components.

protected array getFields(array $build, EntityDisplayWithLayoutInterface $display, string $display_context)

Gets the fields that need to be processed.

Parameters

array $build

A renderable array representing the entity content or form.

EntityDisplayWithLayoutInterface $display

The entity display holding the display options configured for the entity components.

string $display_context

The display context, either 'form' or 'view'.

Return Value

array

An array of configurable fields present in the build.