class MoveBlockController implements ContainerInjectionInterface (View source)

internal  Controller classes are internal.
 

Defines a controller to move a block.

Traits

Provides AJAX responses to rebuild the Layout Builder.

Properties

protected LayoutTempstoreRepositoryInterface $layoutTempstoreRepository

The layout tempstore repository.

Methods

rebuildAndClose(SectionStorageInterface $section_storage)

Rebuilds the layout.

rebuildLayout(SectionStorageInterface $section_storage)

Rebuilds the layout.

__construct(LayoutTempstoreRepositoryInterface $layout_tempstore_repository)

LayoutController constructor.

static 
create(ContainerInterface $container)

Instantiates a new instance of this class.

build(SectionStorageInterface $section_storage, int $delta_from, int $delta_to, string $region_to, string $block_uuid, string|null $preceding_block_uuid = NULL)

Moves a block to another region.

Details

protected AjaxResponse rebuildAndClose(SectionStorageInterface $section_storage)

Rebuilds the layout.

Parameters

SectionStorageInterface $section_storage

The section storage.

Return Value

AjaxResponse

An AJAX response to either rebuild the layout and close the dialog, or reload the page.

protected AjaxResponse rebuildLayout(SectionStorageInterface $section_storage)

Rebuilds the layout.

Parameters

SectionStorageInterface $section_storage

The section storage.

Return Value

AjaxResponse

An AJAX response to either rebuild the layout and close the dialog, or reload the page.

__construct(LayoutTempstoreRepositoryInterface $layout_tempstore_repository)

LayoutController constructor.

Parameters

LayoutTempstoreRepositoryInterface $layout_tempstore_repository

The layout tempstore repository.

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.

AjaxResponse build(SectionStorageInterface $section_storage, int $delta_from, int $delta_to, string $region_to, string $block_uuid, string|null $preceding_block_uuid = NULL)

Moves a block to another region.

Parameters

SectionStorageInterface $section_storage

The section storage.

int $delta_from

The delta of the original section.

int $delta_to

The delta of the destination section.

string $region_to

The new region for this block.

string $block_uuid

The UUID for this block.

string|null $preceding_block_uuid

(optional) If provided, the UUID of the block to insert this block after.

Return Value

AjaxResponse

An AJAX response.