class AddSectionController implements ContainerInjectionInterface (View source)

internal  Controller classes are internal.
 

Defines a controller to add a new section.

Traits

Provides a helper to determine if the current request is via AJAX.

Provides AJAX responses to rebuild the Layout Builder.

Properties

protected LayoutTempstoreRepositoryInterface $layoutTempstoreRepository

The layout tempstore repository.

Methods

bool
isAjax()

Determines if the current request is via AJAX.

getRequestWrapperFormat()

Gets the wrapper format of the current request.

rebuildAndClose(SectionStorageInterface $section_storage)

Rebuilds the layout.

rebuildLayout(SectionStorageInterface $section_storage)

Rebuilds the layout.

__construct(LayoutTempstoreRepositoryInterface $layout_tempstore_repository)

AddSectionController constructor.

static 
create(ContainerInterface $container)

Instantiates a new instance of this class.

Response
build(SectionStorageInterface $section_storage, int $delta, string $plugin_id)

Adds the new section.

Details

protected bool isAjax()

Determines if the current request is via AJAX.

Return Value

bool

TRUE if the current request is via AJAX, FALSE otherwise.

protected getRequestWrapperFormat()

Gets the wrapper format of the current request.

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)

AddSectionController 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.

Response build(SectionStorageInterface $section_storage, int $delta, string $plugin_id)

Adds the new section.

Parameters

SectionStorageInterface $section_storage

The section storage.

int $delta

The delta of the section to splice.

string $plugin_id

The plugin ID of the layout to add.

Return Value

Response

The controller response.