class PaginateViewHelper extends AbstractWidgetViewHelper (View source)

This ViewHelper renders a Pagination of objects.

= Examples =

// use {paginatedBlogs} as you used {blogs} before, most certainly inside // a loop. ``` // This example will display at the maximum 10 links and tries to the settings // pagesBefore and pagesAfter into account to get the best result ``` = Performance characteristics = In the above example, it looks like {blogs} contains all Blog objects, thus you might wonder if all objects were fetched from the database. However, the blogs are NOT fetched from the database until you actually use them, so the paginate ViewHelper will adjust the query sent to the database and receive only the small subset of objects. So, there is no negative performance overhead in using the Paginate Widget.

Properties

protected ControllerContext $controllerContext

Controller Context to use

from  AbstractViewHelper
protected ObjectManagerInterface $objectManager from  AbstractViewHelper
protected LoggerInterface $logger from  AbstractViewHelper
protected bool $escapeOutput from  AbstractWidgetViewHelper
protected PaginateController $controller
protected bool $ajaxWidget

If set to true, it is an AJAX widget.

from  AbstractWidgetViewHelper
protected bool $storeConfigurationInSession

If set to false, this widget won't create a session (only relevant for AJAX widgets).

from  AbstractWidgetViewHelper

Methods

void
setRenderingContext(RenderingContextInterface $renderingContext)

No description

void
injectObjectManager(ObjectManagerInterface $objectManager)

No description

void
injectLogger(LoggerInterface $logger)

Injects the (system) logger based on PSR-3.

AbstractViewHelper
registerArgument(string $name, string $type, string $description, bool $required = false, mixed $defaultValue = null, bool|null $escape = null)

Register a new argument. Call this method from your ViewHelper subclass inside the initializeArguments() method.

AbstractViewHelper
overrideArgument(string $name, string $type, string $description, bool $required = false, mixed $defaultValue = null, bool|null $escape = null)

Overrides a registered argument. Call this method from your ViewHelper subclass inside the initializeArguments() method if you want to override a previously registered argument.

void
injectAjaxWidgetContextHolder(AjaxWidgetContextHolder $ajaxWidgetContextHolder)

No description

void
injectWidgetContext(WidgetContext $widgetContext)

No description

void
initializeArguments()

Initialize the arguments.

string
initializeArgumentsAndRender()

Initialize the arguments of the ViewHelper, and call the render() method of the ViewHelper.

void
setChildNodes(array $childNodes)

Stores the syntax tree child nodes in the Widget Context, so they can be rendered with lateron.

array
getWidgetConfiguration()

Generate the configuration for this widget. Override to adjust.

array
getAjaxWidgetConfiguration()

Generate the configuration for this widget in AJAX context.

array
getNonAjaxWidgetConfiguration()

Generate the configuration for this widget in non-AJAX context.

string
initiateSubRequest()

Initiate a sub request to $this->controller. Make sure to fill $this->controller via Dependency Injection.

void
resetState()

Resets the ViewHelper state by creating a fresh WidgetContext

string
compile(string $argumentsName, string $closureName, string $initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler)

No description

string
render()

Render this view helper

Details

void setRenderingContext(RenderingContextInterface $renderingContext)

No description

Parameters

RenderingContextInterface $renderingContext

Return Value

void

void injectObjectManager(ObjectManagerInterface $objectManager)

No description

Parameters

ObjectManagerInterface $objectManager

Return Value

void

void injectLogger(LoggerInterface $logger)

Injects the (system) logger based on PSR-3.

Parameters

LoggerInterface $logger

Return Value

void

protected AbstractViewHelper registerArgument(string $name, string $type, string $description, bool $required = false, mixed $defaultValue = null, bool|null $escape = null)

Register a new argument. Call this method from your ViewHelper subclass inside the initializeArguments() method.

This exists only to throw our own exception!

Parameters

string $name

Name of the argument

string $type

Type of the argument

string $description

Description of the argument

bool $required

If true, argument is required. Defaults to false.

mixed $defaultValue

Default value of argument

bool|null $escape

Can be toggled to TRUE to force escaping of variables and inline syntax passed as argument value.

Return Value

AbstractViewHelper

$this, to allow chaining.

Exceptions

Exception

protected AbstractViewHelper overrideArgument(string $name, string $type, string $description, bool $required = false, mixed $defaultValue = null, bool|null $escape = null)

Overrides a registered argument. Call this method from your ViewHelper subclass inside the initializeArguments() method if you want to override a previously registered argument.

This exists only to throw our own exception!

Parameters

string $name

Name of the argument

string $type

Type of the argument

string $description

Description of the argument

bool $required

If true, argument is required. Defaults to false.

mixed $defaultValue

Default value of argument

bool|null $escape

Can be toggled to TRUE to force escaping of variables and inline syntax passed as argument value.

Return Value

AbstractViewHelper

$this, to allow chaining.

Exceptions

Exception

See also

registerArgument()

bool isEscapingInterceptorEnabled()

No description

Return Value

bool

void injectAjaxWidgetContextHolder(AjaxWidgetContextHolder $ajaxWidgetContextHolder)

No description

Parameters

AjaxWidgetContextHolder $ajaxWidgetContextHolder

Return Value

void

void injectWidgetContext(WidgetContext $widgetContext)

No description

Parameters

WidgetContext $widgetContext

Return Value

void

void initializeArguments()

Initialize the arguments.

Return Value

void

Exceptions

Exception

string initializeArgumentsAndRender()

Initialize the arguments of the ViewHelper, and call the render() method of the ViewHelper.

Return Value

string

the rendered ViewHelper.

void setChildNodes(array $childNodes)

Stores the syntax tree child nodes in the Widget Context, so they can be rendered with lateron.

Parameters

array $childNodes

Return Value

void

protected array getWidgetConfiguration()

Generate the configuration for this widget. Override to adjust.

Return Value

array

protected array getAjaxWidgetConfiguration()

Generate the configuration for this widget in AJAX context.

By default, returns getWidgetConfiguration(). Should become API later.

Return Value

array

protected array getNonAjaxWidgetConfiguration()

Generate the configuration for this widget in non-AJAX context.

By default, returns getWidgetConfiguration(). Should become API later.

Return Value

array

protected string initiateSubRequest()

Initiate a sub request to $this->controller. Make sure to fill $this->controller via Dependency Injection.

Return Value

string

the response content of this request.

Exceptions

InvalidControllerException
MissingControllerException
InfiniteLoopException
StopActionException

void resetState()

Resets the ViewHelper state by creating a fresh WidgetContext

Return Value

void

string compile(string $argumentsName, string $closureName, string $initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler)

No description

Parameters

string $argumentsName
string $closureName
string $initializationPhpCode
ViewHelperNode $node
TemplateCompiler $compiler

Return Value

string

string render()

Render this view helper