class DateViewHelper extends AbstractLocaleAwareViewHelper (View source)

Formats a \DateTime object.

= Examples =

{dateObject} ``` 1980-12-13 (depending on the current date) {dateObject} ``` 01:23 (depending on the current time) +1 week 2 days 4 hours 2 seconds ``` 13.12.1980 - 21:03:42 (depending on the current time, see http://www.php.net/manual/en/function.strtotime.php) @{someTimestamp} ``` 13.12.1980 - 21:03:42 (depending on the current time. Don't forget the "@" in front of the timestamp see http://www.php.net/manual/en/function.strtotime.php) {f:format.date(date: dateObject)} ``` 1980-12-13 (depending on the value of {dateObject}) {dateObject -> f:format.date()} ``` 1980-12-13 (depending on the value of {dateObject}) {dateObject -> f:format.date(localeFormatType: 'date', forceLocale: true)} ``` 13.12.1980 (depending on the value of {dateObject} and the current locale) {dateObject -> f:format.date(forceLocale: 'de_DE')} ``` 13.12.1980 11:15:42 (depending on the value of {dateObject})

Properties

protected ControllerContext $controllerContext

Controller Context to use

from  AbstractViewHelper
protected ObjectManagerInterface $objectManager from  AbstractViewHelper
protected LoggerInterface $logger from  AbstractViewHelper
protected Service $localizationService from  AbstractLocaleAwareViewHelper
protected bool $escapeChildren
protected DatetimeFormatter $datetimeFormatter

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.

injectLocalizationService(Service $localizationService)

No description

getLocale()

Get the locale to use for all locale specific functionality.

void
initializeArguments()

Initialize the arguments.

string
render()

Render the supplied DateTime object as a formatted date.

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

__construct()

Constructor

injectLocalizationService(Service $localizationService)

No description

Parameters

Service $localizationService

protected Locale getLocale()

Get the locale to use for all locale specific functionality.

Return Value

Locale

The locale to use or NULL if locale should not be used

Exceptions

InvalidVariableException

void initializeArguments()

Initialize the arguments.

Return Value

void

string render()

Render the supplied DateTime object as a formatted date.

Return Value

string

Formatted date

Exceptions

Exception