class Controller extends Controller (View source)

Traits

Trait ApplicationAwareTrait A trait used with ApplicationAwareInterface

Properties

protected Application $app from ApplicationAwareTrait
protected $helpers
protected array $sets The values to be sent to views. from AbstractController
protected string|null $action The action to be performed. from AbstractController
protected Request|null $request The current request instance. from AbstractController
protected array|null $parameters The action parameters. from AbstractController
protected EntityManager $entityManager from Controller
protected Key|null $attributeKey from Controller
protected AbstractValue $attributeValue from Controller
protected $searchIndexFieldDefinition from Controller
protected false|array $requestArray from Controller
protected $calendar

Methods

setApplication(Application $app)

Setter method for the application

__construct(EntityManager $entityManager)

No description

Request
getRequest()

Get the current request instance.

setRequest(Request $request)

Set the current request instance.

requireAsset()

Add an asset required in views.

addHeaderItem(string $item)

Adds an item to the view's header. This item will then be automatically printed out before the section of the page.

addFooterItem(string $item)

Adds an item to the view's footer. This item will then be automatically printed out before the section of the page.

set(string $key, mixed $val)

Set a value to be sent to the view.

array
getSets()

Get the values to be sent to views.

bool
shouldRunControllerTask()

Should the action be executed? Override this method to answer something different than true.

array
getHelperObjects()

Get the the helpers that will be be automatically sent to Views as variables.

mixed
get(string|null $key = null, mixed $defaultValue = null)

Get the whole $_GET array or a specific querystring value.

getTask() deprecated

No description

string|null
getAction()

Get the action to be performed.

array|null
getParameters()

Get the action parameters.

on_start()

Override this method to perform controller initializations.

on_before_render()

Override this method to do something right before the view is rendered.

isPost() deprecated

No description

mixed
post($field = false, mixed $defaultValue = null)

Get the whole $_POST array or a specific posted value.

redirect() deprecated

Redirect the clients to a specific URL/page (specify path(s) as argument(s) of this function).

runTask(mixed $action, mixed $parameters) deprecated

No description

mixed
runAction(string $action, array $parameters = [])

Perform an action of this controller (if shouldRunControllerTask returns true).

mixed
request($field = false)

Get the whole $_REQUEST array or a specific requested value.

__destruct()

No description

getIconFormatter()

Return a formatter object that provides an icon that will be shown in the list of attributes.

setAttributeType($attributeType)

No description

getAttributeType()

Returns a Type entity.

string|null
getAttributeTypeFileURL(string $_file)

No description

validateKey(array|false $data = false)

No description

string
getAttributeKeySettingsClass()

No description

mixed
setAttributeKey($attributeKey)

No description

getAttributeKey()

Returns a Key entity.

saveKey(array $data)

This method is called any time an attribute key is created or updated.

duplicateKey(mixed $newAK)

No description

deleteKey()

No description

string
getAttributeValueClass()

Is used to determine the name of the entity used to store the attribute value.

setAttributeValue(AbstractValue|null $attributeValue)

No description

getAttributeValue()

Get Attribute Value object.

getAttributeValueObject()

No description

createDefaultAttributeValue()

Create the default attribute value (if needed).

createAttributeValueFromRequest()

Is run when an attribute is saved through the standard user interfaces like the sitemap attributes dialog, the attributes panel, or the user attributes slideouts.

deleteValue()

No description

array|null
string|int
getSearchIndexValue()

This value will be used by the search index.

string|null
searchKeywords(mixed $keywords, QueryBuilder $queryBuilder)

No description

filterByAttribute(AttributedItemList $list, mixed $value, string $comparison = '=')

No description

importKey(SimpleXMLElement $element)

No description

mixed
exportKey(mixed $ak)

No description

mixed
importValue(SimpleXMLElement $akv)

No description

mixed
getDisplayValue()

For a DateTime implementation this could for example mean that the value is formatted and localized.

getView()

No description

string
field(string $fieldName)

No description

string
getLabelID()

Get the ID to use for label elements.

label(string|bool $customText = false)

No description

setRequestArray(array|false $array)

No description

getValidator()

No description

bool
requestFieldExists()

No description

setupAndRun(string $method)

No description

saveForm(mixed $data) deprecated

No description

saveValue(mixed $mixed) deprecated

No description

getAttributeValueID() deprecated

No description

Settings|null
retrieveAttributeKeySettings()

No description

searchForm($list)

No description

search()

No description

form()

No description

validateForm($p)

No description

validateValue()

No description

string
getAttributeValueTextRepresentation()

Get a string containing the text representation of the attribute value currently set in the controller.

updateAttributeValueFromTextRepresentation(string $textRepresentation, ErrorList $warnings)

Update or create the attribute value starting from its text representation.

getPlainTextValue()

No description

getValue()

No description

Details

setApplication(Application $app)

Setter method for the application

Parameters

Application $app

__construct(EntityManager $entityManager)

Parameters

EntityManager $entityManager

Request getRequest()

Get the current request instance.

Return Value

Request

setRequest(Request $request)

Set the current request instance.

Parameters

Request $request

requireAsset()

Add an asset required in views.

This function accept the same parameters as the requireAsset method of the ResponseAssetGroup.

See also

ResponseAssetGroup::requireAsset

addHeaderItem(string $item)

Adds an item to the view's header. This item will then be automatically printed out before the section of the page.

Parameters

string $item

addFooterItem(string $item)

Adds an item to the view's footer. This item will then be automatically printed out before the section of the page.

Parameters

string $item

set(string $key, mixed $val)

Set a value to be sent to the view.

Parameters

string $key The name of the value
mixed $val The value

array getSets()

Get the values to be sent to views.

Return Value

array

bool shouldRunControllerTask()

Should the action be executed? Override this method to answer something different than true.

Return Value

bool

array getHelperObjects()

Get the the helpers that will be be automatically sent to Views as variables.

Array keys are the variable names, array values are the helper instances.

Return Value

array

mixed get(string|null $key = null, mixed $defaultValue = null)

Get the whole $_GET array or a specific querystring value.

Parameters

string|null $key set to null to get the whole $_GET array, or a string to get a specific value in the controller sets or from the querystring parameters
mixed $defaultValue what to return if $key is specified but it does not exist neither in the sets nor in the querystring

Return Value

mixed

getTask() deprecated

deprecated use the getAction() method

string|null getAction()

Get the action to be performed.

Return Value

string|null

array|null getParameters()

Get the action parameters.

Return Value

array|null

on_start()

Override this method to perform controller initializations.

on_before_render()

Override this method to do something right before the view is rendered.

For instance, you can call $this->set('variableName', $variableValue) to send the view additional sets.

isPost() deprecated

deprecated Use $this->getRequest()->isPost();

mixed post($field = false, mixed $defaultValue = null)

Get the whole $_POST array or a specific posted value.

Parameters

$field
mixed $defaultValue what to return if $key is specified but it does not exist in the $_POST

Return Value

mixed

See also

\Concrete\Core\Controller\AbstractController::post()

redirect() deprecated

deprecated you should return a Response instance from your methods

Redirect the clients to a specific URL/page (specify path(s) as argument(s) of this function).

runTask(mixed $action, mixed $parameters) deprecated

deprecated use the runAction method

Parameters

mixed $action
mixed $parameters

mixed runAction(string $action, array $parameters = [])

Perform an action of this controller (if shouldRunControllerTask returns true).

Parameters

string $action the action to be performed
array $parameters the action parameters

Return Value

mixed in case the action is executed, you'll receive the result of the action, or NULL otherwise

mixed request($field = false)

Get the whole $_REQUEST array or a specific requested value.

Parameters

$field

Return Value

mixed

See also

\Concrete\Core\Controller\AbstractController::request()

__destruct()

IconFormatterInterface getIconFormatter()

Return a formatter object that provides an icon that will be shown in the list of attributes.

Example implementation: return new FontAwesomeIconFormatter('check-square');

Return Value

IconFormatterInterface

setAttributeType($attributeType)

Parameters

$attributeType

See also

\Concrete\Core\Attribute\AttributeInterface::setAttributeType()

Type getAttributeType()

Returns a Type entity.

The Type object is mapped with a row from the AttributeTypes table. Use the object for example to retrieve the current attribute type handle (e.g. 'date_time').

Return Value

Type

See also

\Concrete\Core\Attribute\AttributeInterface::getAttributeType()

string|null getAttributeTypeFileURL(string $_file)

Parameters

string $_file

Return Value

string|null

ErrorList validateKey(array|false $data = false)

Parameters

array|false $data

Return Value

ErrorList

string getAttributeKeySettingsClass()

Return Value

string

mixed setAttributeKey($attributeKey)

Parameters

$attributeKey

Return Value

mixed

See also

AttributeInterface::setAttributeKey()

AttributeKeyInterface getAttributeKey()

Returns a Key entity.

A key is mapped with a row from the AttributeKeys table. Use the object for example to retrieve the current attribute handle (e.g. 'meta_title').

Return Value

AttributeKeyInterface

See also

\Concrete\Core\Attribute\AttributeInterface::getAttributeKey()

saveKey(array $data)

This method is called any time an attribute key is created or updated.

$data is simply the POST values from the form.

Parameters

array $data

See also

\Concrete\Core\Attribute\AttributeInterface::saveKey()

duplicateKey(mixed $newAK)

Parameters

mixed $newAK

deleteKey()

Settings createAttributeKeySettings()

Return Value

Settings

Settings getAttributeKeySettings()

Return Value

Settings

string getAttributeValueClass()

Is used to determine the name of the entity used to store the attribute value.

You can reuse this throughout your controllers, but it's used by the getAttributeValueObject() method in the base controller to retrieve the relevant attribute data value object.

Return Value

string

setAttributeValue(AbstractValue|null $attributeValue)

Parameters

AbstractValue|null $attributeValue

AttributeValueInterface getAttributeValue()

Get Attribute Value object.

Return Value

AttributeValueInterface

See also

\Concrete\Core\Attribute\AttributeInterface::getAttributeValue()

AbstractValue|null getAttributeValueObject()

Return Value

AbstractValue|null

AbstractValue|null createDefaultAttributeValue()

Create the default attribute value (if needed).

Return Value

AbstractValue|null

AttributeValueInterface createAttributeValueFromRequest()

Is run when an attribute is saved through the standard user interfaces like the sitemap attributes dialog, the attributes panel, or the user attributes slideouts.

AttributeValueInterface createAttributeValue($value)

Parameters

$value

Return Value

AttributeValueInterface

deleteValue()

array|null getSearchIndexFieldDefinition()

Return Value

array|null

string|int getSearchIndexValue()

This value will be used by the search index.

Return Value

string|int

string|null searchKeywords(mixed $keywords, QueryBuilder $queryBuilder)

Parameters

mixed $keywords
QueryBuilder $queryBuilder

Return Value

string|null

filterByAttribute(AttributedItemList $list, mixed $value, string $comparison = '=')

Parameters

AttributedItemList $list
mixed $value
string $comparison

importKey(SimpleXMLElement $element)

Parameters

SimpleXMLElement $element

mixed exportKey(mixed $ak)

Parameters

mixed $ak

Return Value

mixed

mixed importValue(SimpleXMLElement $akv)

Parameters

SimpleXMLElement $akv

Return Value

mixed

SimpleXMLElement exportValue(SimpleXMLElement $akv)

Parameters

SimpleXMLElement $akv

Return Value

SimpleXMLElement

mixed getDisplayValue()

For a DateTime implementation this could for example mean that the value is formatted and localized.

Return Value

mixed

FormViewInterface getControlView(ContextInterface $context)

Parameters

ContextInterface $context

Return Value

FormViewInterface

View getView()

Return Value

View

string field(string $fieldName)

Parameters

string $fieldName

Return Value

string

string getLabelID()

Get the ID to use for label elements.

Return Value

string

label(string|bool $customText = false)

Parameters

string|bool $customText

setRequestArray(array|false $array)

Parameters

array|false $array

ValidatorInterface getValidator()

Return Value

ValidatorInterface

bool requestFieldExists()

Return Value

bool

setupAndRun(string $method)

Parameters

string $method

saveForm(mixed $data) deprecated

deprecated

Parameters

mixed $data

saveValue(mixed $mixed) deprecated

deprecated

Parameters

mixed $mixed

getAttributeValueID() deprecated

deprecated

protected Settings|null retrieveAttributeKeySettings()

Return Value

Settings|null

searchForm($list)

Parameters

$list

form()

validateForm($p)

Parameters

$p

validateValue()

string getAttributeValueTextRepresentation()

Get a string containing the text representation of the attribute value currently set in the controller.

Return Value

string

See also

\Concrete\Core\Attribute\SimpleTextExportableAttributeInterface::getAttributeValueTextRepresentation()

AbstractValue|null updateAttributeValueFromTextRepresentation(string $textRepresentation, ErrorList $warnings)

Update or create the attribute value starting from its text representation.

Parameters

string $textRepresentation the text representation of the attribute value
ErrorList $warnings An ErrorList instance that the method can add decoding warnings to

Return Value

AbstractValue|null Returns NULL if the controller doesn't have already a value and $textRepresentation is empty

See also

\Concrete\Core\Attribute\SimpleTextExportableAttributeInterface::updateAttributeValueFromTextRepresentation()

getPlainTextValue()

getValue()