\Bootstrap\AspectFormHelperAspect

Applies some Twitter Bootstrap CSS styles to Form elements.

By default all CSS and HTML code generated automatically by QuickAppsCMS follow Twitter Bootstrap's conventions.

If you need disable Twitter Bootstrap's CSS classes to be applied, you can set the special bootstrap key as FALSE in your array of options. For example:

echo $this->Form->create($userEntity, ['bootstrap' => false]);
    echo $this->Form->input('user_name', ['bootstrap' => false]);
echo $this->Form->end();

Summary

Methods
Properties
Constants
alterCreate()
alterInput()
alterTextarea()
alteSelectbox()
alterButton()
alterSubmit()
cache()
dropCache()
getProperty()
setProperty()
No public properties found
No constants found
_addClass()
_addTemplates()
$_templates
$_cache
N/A
No private methods found
No private properties found
N/A

Properties

$_templates

$_templates : array

Custom templates for FormHelper.

Type

array

$_cache

$_cache : array

Used internally.

Type

array

Methods

alterCreate()

alterCreate(\Go\Aop\Intercept\MethodInvocation $invocation) : boolean

Adds custom templates on Form::create().

Parameters

\Go\Aop\Intercept\MethodInvocation $invocation

Invocation

Returns

boolean —

Whether object invocation should proceed or not

alterInput()

alterInput(\Go\Aop\Intercept\MethodInvocation $invocation) : boolean

Appends some CSS classes to generic input (text, textarea, select) elements.

Parameters

\Go\Aop\Intercept\MethodInvocation $invocation

Invocation

Returns

boolean —

Whether object invocation should proceed or not

alterTextarea()

alterTextarea(\Go\Aop\Intercept\MethodInvocation $invocation) : boolean

Appends some CSS classes to textarea elements.

Parameters

\Go\Aop\Intercept\MethodInvocation $invocation

Invocation

Returns

boolean —

Whether object invocation should proceed or not

alteSelectbox()

alteSelectbox(\Go\Aop\Intercept\MethodInvocation $invocation) : boolean

Appends some CSS classes to select elements.

Parameters

\Go\Aop\Intercept\MethodInvocation $invocation

Invocation

Returns

boolean —

Whether object invocation should proceed or not

alterButton()

alterButton(\Go\Aop\Intercept\MethodInvocation $invocation) : boolean

Appends some CSS classes to generic buttons.

Parameters

\Go\Aop\Intercept\MethodInvocation $invocation

Invocation

Returns

boolean —

Whether object invocation should proceed or not

alterSubmit()

alterSubmit(\Go\Aop\Intercept\MethodInvocation $invocation) : boolean

Appends some CSS classes to submit buttons.

Parameters

\Go\Aop\Intercept\MethodInvocation $invocation

Invocation

Returns

boolean —

Whether object invocation should proceed or not

cache()

cache(null|string $key, mixed $value) : mixed

Reads, writes or search internal class's cache.

Usages:

  • When reading if no cache key is found NULL will be returned. e.g. $null = static::cache('invalid-key');
  • When writing, this method return the value that was written. e.g. $value = static::cache('key', 'value');
  • Set both arguments to NULL to read the whole cache content at the moment. e.g. $allCache = static::cache()
  • Set key to null and value to anything to find the first key holding the given value. e.g. $key = static::cache(null, 'search key for this value'), if no key for the given value is found NULL will be returned.

Examples:

Writing cache:

static::cache('user_name', 'John');
// returns 'John'

static::cache('user_last', 'Locke');
// returns 'Locke'

Reading cache:

static::cache('user_name');
// returns: John

static::cache('unexisting_key');
// returns: null

static::cache();
// Reads the entire cache
// returns: ['user_name' => 'John', 'user_last' => 'Locke']

Searching keys:

static::cache(null, 'Locke');
// returns: user_last

static::cache(null, 'Unexisting Value');
// returns: null

Parameters

null|string $key

Cache key to read or write, set both $key and $value to get the whole cache information

mixed $value

Values to write into the given $key, or null indicates reading from cache

Returns

mixed

dropCache()

dropCache(string|null $key) : void

Drops the entire cache or a specific key.

Usage:

static::dropCache('user_cache'); // removes "user_cache" only
static::dropCache(); // removes every key

Parameters

string|null $key

Cache key to clear, if NULL the entire cache will be erased.

getProperty()

getProperty(object $object, string $name) : mixed

Get property value from the given object, regardless its visibility.

Parameters

object $object

The object

string $name

Name of the property to get

Returns

mixed —

Property value

setProperty()

setProperty(object $object, string $propertyName, mixed $value) : void

Sets property value of the given object, regardless its visibility.

Parameters

object $object

The object

string $propertyName

Name of the property to set

mixed $value

The new value

_addClass()

_addClass(\Cake\View\Helper\FormHelper $formHelper, array $options, string $class) : array

Add custom CSS classes to array of options.

Parameters

\Cake\View\Helper\FormHelper $formHelper

Instance of FormHelper

array $options

Input's options

string $class

CSS classes to add

Returns

array

_addTemplates()

_addTemplates(\Cake\View\Helper\FormHelper $formHelper) : void

Add custom set of templates to FormHelper.

Parameters

\Cake\View\Helper\FormHelper $formHelper

Instance of FormHelper