class ViewAjaxController implements ContainerInjectionInterface (View source)

Defines a controller to load a view via AJAX.

Properties

protected EntityStorageInterface $storage

The entity storage for views.

protected ViewExecutableFactory $executableFactory

The factory to load a view executable with.

protected RendererInterface $renderer

The renderer.

protected CurrentPathStack $currentPath

The current path.

protected RedirectDestinationInterface $redirectDestination

The redirect destination.

Methods

__construct(EntityStorageInterface $storage, ViewExecutableFactory $executable_factory, RendererInterface $renderer, CurrentPathStack $current_path, RedirectDestinationInterface $redirect_destination)

Constructs a ViewAjaxController object.

static 
create(ContainerInterface $container)

Instantiates a new instance of this class.

ajaxView(Request $request)

Loads and renders a view via AJAX.

Details

__construct(EntityStorageInterface $storage, ViewExecutableFactory $executable_factory, RendererInterface $renderer, CurrentPathStack $current_path, RedirectDestinationInterface $redirect_destination)

Constructs a ViewAjaxController object.

Parameters

EntityStorageInterface $storage

The entity storage for views.

ViewExecutableFactory $executable_factory

The factory to load a view executable with.

RendererInterface $renderer

The renderer.

CurrentPathStack $current_path

The current path.

RedirectDestinationInterface $redirect_destination

The redirect destination.

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.

ViewAjaxResponse ajaxView(Request $request)

Loads and renders a view via AJAX.

Parameters

Request $request

The current request object.

Return Value

ViewAjaxResponse

The view response as ajax response.

Exceptions

NotFoundHttpException