Controller
class Controller extends Controller implements SimpleTextExportableAttributeInterface (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 | |
protected Key|null | $attributeKey | from Controller | |
protected AbstractValue | $attributeValue | from Controller | |
protected ObjectInterface | $attributeObject | from Controller | |
protected | $searchIndexFieldDefinition | ||
protected false|array | $requestArray | from Controller | |
private | $akSelectAllowMultipleValues | ||
private | $akSelectAllowOtherValues | ||
private | $akHideNoneOption | ||
private | $akSelectOptionDisplayOrder | ||
private | $akDisplayMultipleValuesOnSelect |
Methods
Adds an item to the view's header. This item will then be automatically printed out before the
section of the page.Adds an item to the view's footer. This item will then be automatically printed out before the section of the page.
Should the action be executed? Override this method to answer something different than true.
Get the the helpers that will be be automatically sent to Views as variables.
Get the whole $_GET array or a specific querystring value.
Override this method to do something right before the view is rendered.
Get the whole $_POST array or a specific posted value.
Redirect the clients to a specific URL/page (specify path(s) as argument(s) of this function).
Build a response that redirects clients to a specific URL/page (specify path(s) as argument(s) of $args).
Perform an action of this controller (if shouldRunControllerTask returns true).
Get the whole $_REQUEST array or a specific requested value.
Return a formatter object that provides an icon that will be shown in the list of attributes.
No description
No description
This method is called any time an attribute key is created or updated.
Is used to determine the name of the entity used to store the attribute value.
Create the default attribute value (if needed).
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.
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.
This value will be used by the search index.
No description
No description
For a DateTime implementation this could for example mean that the value is formatted and localized.
Get the ID to use for label elements. Not applicable in form views that do not contain
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Returns a list of available options optionally filtered by an sql $like statement ex: startswith%.
Convenience methods to retrieve a select attribute key's settings.
No description
No description
Get a string containing the text representation of the attribute value currently set in the controller.
Update or create the attribute value starting from its text representation.
No description
Used by selectize. Automatically takes a value request and converts it into tag/text key value pairs.
No description
Details
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.
This function accept the same parameters as the requireAsset method of the ResponseAssetGroup.
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.
Array keys are the variable names, array values are the helper instances.
mixed
get(string|null $key = null, mixed $defaultValue = null)
Get the whole $_GET array or a specific querystring value.
getTask()
deprecated
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.
For instance, you can call $this->set('variableName', $variableValue) to send the view additional sets.
isPost()
deprecated
deprecated
No description
mixed
post($field = false, mixed $defaultValue = null)
Get the whole $_POST array or a specific posted value.
redirect()
deprecated
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
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
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');
setAttributeType($attributeType)
No description
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)
No description
string|null
getAttributeTypeFileURL(string $_file)
No description
ErrorList
validateKey(array|false $data = false)
No description
string
getAttributeKeySettingsClass()
No description
mixed
setAttributeKey($attributeKey)
No description
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.
duplicateKey(mixed $newAK)
No description
deleteKey()
No description
Settings
createAttributeKeySettings()
No description
Settings
getAttributeKeySettings()
No description
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.
setAttributeValue(AbstractValue|null $attributeValue)
No description
AttributeValueInterface
getAttributeValue()
Get Attribute Value object.
AbstractValue|null
getAttributeValueObject()
No description
AbstractValue|null
createDefaultAttributeValue()
Create the default attribute value (if needed).
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.
deleteValue()
No description
array|null
getSearchIndexFieldDefinition()
No description
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
SimpleXMLElement
exportValue(SimpleXMLElement $akn)
No description
mixed
getDisplayValue()
For a DateTime implementation this could for example mean that the value is formatted and localized.
FormViewInterface
getControlView(ContextInterface $context)
No description
View
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
deprecated
Get the ID to use for label elements.
label(string|bool $customText = false)
deprecated
deprecated
No description
setRequestArray(array|false $array)
No description
ValidatorInterface
getValidator()
No description
bool
requestFieldExists()
No description
setupAndRun(string $method)
No description
saveForm(mixed $data)
deprecated
deprecated
No description
saveValue(mixed $mixed)
deprecated
deprecated
No description
getAttributeValueID()
deprecated
deprecated
No description
protected 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
getSelectedOptions()
No description
action_load_autocomplete_values()
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.
AbstractValue|null
updateAttributeValueFromTextRepresentation(string $textRepresentation, ErrorList $warnings)
Update or create the attribute value starting from its text representation.
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.
private
getSelectValuesFromPost()
No description