class Controller extends Controller implements SimpleTextExportableAttributeInterface, OpenApiSpecifiableInterface, SupportsAttributeValueFromJsonInterface, ApiResourceValueInterface (View source)

Traits

Trait ApplicationAwareTrait A trait used with ApplicationAwareInterface

Properties

protected Application $app from  ApplicationAwareTrait
protected string[] $helpers

The handles of the helpers to be returned by the getHelperObjects method.

from  AbstractController
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
Type|null deprecated $attributeType from  Controller
protected Key|null $attributeKey from  Controller
protected AbstractValue $attributeValue from  Controller
protected ObjectInterface $attributeObject from  Controller
protected $searchIndexFieldDefinition
protected false|array $requestArray from  Controller
protected $akSelectAllowMultipleValues
protected $akSelectAllowOtherValues
protected $akHideNoneOption
protected $akSelectOptionDisplayOrder
protected $akDisplayMultipleValuesOnSelect

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

RedirectResponse
buildRedirect(array|string|UrlInterface $destination, int $httpResponseCode = Response::HTTP_FOUND)

Build a response that redirects clients to a specific URL/page (specify path(s) as argument(s) of $args).

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.

executeCommand(mixed $command)

Dispatches a command to the command bus.

dispatchBatch(Batch $batch)

No description

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

setAttributeObject(ObjectInterface $object)

Set the subject for which the value is being managed.

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.

Type|null|void
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.

createAttributeValue(mixed $value)

Sets select options for a particular attribute If the $value == string, then 1 item is selected if array, then multiple, but only if the attribute in question is a select multiple Note, items CANNOT be added to the pool (even if the attribute allows it) through this process.

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

Settings|null
importKey(SimpleXMLElement $akey)

No description

mixed
exportKey($akey)

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
getControlID()

Get the ID to use for label elements. Not applicable in form views that do not contain

string
getLabelID() deprecated

Get the ID to use for label elements.

label(string|bool $customText = false) deprecated

No description

setRequestArray(array|false $array)

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

type_form()

No description

setAllowedMultipleValues($allow)

No description

setAllowOtherValues($allow)

No description

setHideNoneOption($allow)

No description

setOptionDisplayOrder($order)

No description

setOptions($options)

No description

form()

No description

search()

No description

getOptionByID($id)

No description

getOptionByValue($value, $attributeKey = false)

No description

validateValue()

No description

validateForm($p)

No description

searchForm($list)

No description

Collection|SelectValueOption[]
getSelectedOptions()

No description

getOptionUsageArray($parentPage = false, $limit = 9999)

No description

getOptions(mixed|null $keywords = null)

Returns a list of available options optionally filtered by an sql $like statement ex: startswith%.

getAllowMultipleValues()

Convenience methods to retrieve a select attribute key's settings.

getAllowOtherValues()

No description

getOptionDisplayOrder()

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.

load()

No description

loadSelectedTagValueFromPost(mixed $value)

Used by selectize. Automatically takes a value request and converts it into tag/text key value pairs.

getSelectValuesFromPost()

No description

getOpenApiSpecProperty(Key $key)

No description

mixed
createAttributeValueFromNormalizedJson(mixed $json)

Could be a string, could be an array representation of a more complex request body object

ResourceInterface|null
getApiValueResource()

No description

Details

setApplication(Application $app)

Setter method for the application

Parameters

Application $app

__construct(EntityManager $entityManager)

No description

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

No description

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();

No description

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

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

RedirectResponse buildRedirect(array|string|UrlInterface $destination, int $httpResponseCode = Response::HTTP_FOUND)

Build a response that redirects clients to a specific URL/page (specify path(s) as argument(s) of $args).

Parameters

array|string|UrlInterface $destination

use an Url object to specify the destination URL, or a string/array of strings to build the URL with the resolver

int $httpResponseCode

the HTTP response code

Return Value

RedirectResponse

runTask(mixed $action, mixed $parameters) deprecated

deprecated use the runAction method

No description

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

AbstractController::request

executeCommand(mixed $command)

Dispatches a command to the command bus.

Parameters

mixed $command

dispatchBatch(Batch $batch)

No description

Parameters

Batch $batch

__destruct()

No description

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)

No description

Parameters

$attributeType

See also

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').

setAttributeObject(ObjectInterface $object)

Set the subject for which the value is being managed.

string|null getAttributeTypeFileURL(string $_file)

No description

Parameters

string $_file

Return Value

string|null

ErrorList validateKey(array|false $data = false)

No description

Parameters

array|false $data

Return Value

ErrorList

string getAttributeKeySettingsClass()

No description

Return Value

string

mixed setAttributeKey($attributeKey)

No description

Parameters

$attributeKey

Return Value

mixed

See also

AttributeInterface::setAttributeKey

AttributeKeyInterface|Key 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').

Type|null|void 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

Return Value

Type|null|void

duplicateKey(mixed $newAK)

No description

Parameters

mixed $newAK

deleteKey()

No description

Settings createAttributeKeySettings()

No description

Return Value

Settings

Settings getAttributeKeySettings()

No description

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)

No description

Parameters

AbstractValue|null $attributeValue

AttributeValueInterface getAttributeValue()

Get Attribute Value object.

AbstractValue|null getAttributeValueObject()

No description

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(mixed $value)

Sets select options for a particular attribute If the $value == string, then 1 item is selected if array, then multiple, but only if the attribute in question is a select multiple Note, items CANNOT be added to the pool (even if the attribute allows it) through this process.

Items should now be added to the database if they don't exist already & if the allow checkbox is checked under the attribute settings Code from this bug - http://www.concrete5.org/index.php?cID=595692.

Parameters

mixed $value

Return Value

AttributeValueInterface

deleteValue()

No description

array|null getSearchIndexFieldDefinition()

No description

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)

No description

Parameters

mixed $keywords
QueryBuilder $queryBuilder

Return Value

string|null

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

No description

Parameters

AttributedItemList $list
mixed $value
string $comparison

Settings|null importKey(SimpleXMLElement $akey)

No description

Parameters

SimpleXMLElement $akey

Return Value

Settings|null

mixed exportKey($akey)

No description

Parameters

$akey

Return Value

mixed

mixed importValue(SimpleXMLElement $akv)

No description

Parameters

SimpleXMLElement $akv

Return Value

mixed

SimpleXMLElement exportValue(SimpleXMLElement $akn)

No description

Parameters

SimpleXMLElement $akn

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)

No description

Parameters

ContextInterface $context

Return Value

FormViewInterface

View getView()

No description

Return Value

View

string field(string $fieldName)

No description

Parameters

string $fieldName

Return Value

string

string getControlID()

Get the ID to use for label elements. Not applicable in form views that do not contain

Return Value

string

string getLabelID() deprecated

deprecated

Get the ID to use for label elements.

Return Value

string

label(string|bool $customText = false) deprecated

deprecated . This should be handled by the templates including

No description

Parameters

string|bool $customText

setRequestArray(array|false $array)

No description

Parameters

array|false $array

ValidatorInterface getValidator()

No description

Return Value

ValidatorInterface

bool requestFieldExists()

No description

Return Value

bool

setupAndRun(string $method)

No description

Parameters

string $method

saveForm(mixed $data) deprecated

deprecated

No description

Parameters

mixed $data

saveValue(mixed $mixed) deprecated

deprecated

No description

Parameters

mixed $mixed

getAttributeValueID() deprecated

deprecated

No description

protected Settings|null retrieveAttributeKeySettings()

No description

Return Value

Settings|null

type_form()

No description

setAllowedMultipleValues($allow)

No description

Parameters

$allow

setAllowOtherValues($allow)

No description

Parameters

$allow

setHideNoneOption($allow)

No description

Parameters

$allow

setOptionDisplayOrder($order)

No description

Parameters

$order

setOptions($options)

No description

Parameters

$options

form()

No description

No description

getOptionByID($id)

No description

Parameters

$id

getOptionByValue($value, $attributeKey = false)

No description

Parameters

$value
$attributeKey

validateValue()

No description

validateForm($p)

No description

Parameters

$p

searchForm($list)

No description

Parameters

$list

Collection|SelectValueOption[] getSelectedOptions()

No description

Return Value

Collection|SelectValueOption[]

action_select_autocomplete_values()

No description

action_load_autocomplete_values()

No description

getOptionUsageArray($parentPage = false, $limit = 9999)

No description

Parameters

$parentPage
$limit

getOptions(mixed|null $keywords = null)

Returns a list of available options optionally filtered by an sql $like statement ex: startswith%.

Parameters

mixed|null $keywords

getAllowMultipleValues()

Convenience methods to retrieve a select attribute key's settings.

getAllowOtherValues()

No description

getOptionDisplayOrder()

No description

string getAttributeValueTextRepresentation()

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

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

SimpleTextExportableAttributeInterface::updateAttributeValueFromTextRepresentation

protected load()

No description

protected loadSelectedTagValueFromPost(mixed $value)

Used by selectize. Automatically takes a value request and converts it into tag/text key value pairs.

New options are just text/tag, whereas existing ones are SelectAttributeOption:ID/text.

Parameters

mixed $value

private getSelectValuesFromPost()

No description

SpecProperty getOpenApiSpecProperty(Key $key)

No description

Parameters

Key $key

Return Value

SpecProperty

mixed createAttributeValueFromNormalizedJson(mixed $json)

Could be a string, could be an array representation of a more complex request body object

Parameters

mixed $json

Return Value

mixed

ResourceInterface|null getApiValueResource()

No description

Return Value

ResourceInterface|null