\QuickApps\View\HelperFormHelper

Form helper library.

Overwrites CakePHP's Form Helper and adds alter hooks to every method, so plugins may alter form elements rendering cycle.

Summary

Methods
Properties
Constants
__construct()
input()
prefix()
trigger()
eventDispatcher()
triggered()
No public properties found
No constants found
No protected methods found
$_isRendering
$_prefix
N/A
No private methods found
No private properties found
N/A

Properties

$_isRendering

$_isRendering : boolean

Used by input() method.

Type

boolean

$_prefix

$_prefix : string

Prefix to prepends to every "name" attribute of rendered inputs.

Type

string

Methods

__construct()

__construct(\Cake\View\View $View, array $config)

Construct the widgets and binds the default context providers

Parameters

\Cake\View\View $View

The View this helper is being attached to.

array $config

Configuration settings for the helper.

input()

input( $fieldName, array $options)

{@inheritDoc}

Allows to render Field (EAV virtual columns) in edit mode; it triggers the event Field.<handler>.Entity.edit, it will try to append an * symbol to input label if Field has been marked as "required".

Parameters

$fieldName
array $options

prefix()

prefix(string|null $prefix) : string

Sets/Read input prefix.

Example:

$this->Form->prefix('settings:');
echo $this->Form->input('site_name');
// outputs: <input type="text" name="settings:site_name" />

echo $this->Form->prefix();
// outputs: "settings:"

$this->Form->prefix('');
echo $this->Form->prefix();
// outputs: <empty string>

Parameters

string|null $prefix

The prefix to be set, or leave empty to unset any previous prefix

Returns

string —

Actual prefix always

trigger()

trigger(array|string $eventName) : \Cake\Event\Event

Triggers the given event name. This method provides a shortcut for:

$this->trigger('EventName', $arg1, $arg2, ..., $argn);

You can provide a subject to use by passing an array as first arguments where the first element is the event name and the second one is the subject, if no subject is given $this will be used by default:

$this->trigger(['GetTime', new MySubject()], $arg_0, $arg_1, ..., $arg_n);

You can also indicate an EventDispatcher instance to use by prefixing the event name with <InstanceName>::, for instance:

$this->trigger('Blog::EventName', $arg1, $arg2, ..., $argn);

This will use the EventDispacher instance named Blog and will trigger the event EventName within that instance.

Parameters

array|string $eventName

The event name to trigger

Returns

\Cake\Event\Event —

The event object that was fired

eventDispatcher()

eventDispatcher(string $name) : \QuickApps\Event\EventDispatcher

Gets an instance of the given Event Dispatcher name.

Usage:

$this->eventDispatcher('myDispatcher')
    ->trigger('MyEventName', $argument)
    ->result;

Parameters

string $name

Name of the dispatcher to get, defaults to 'default'

Returns

\QuickApps\Event\EventDispatcher

triggered()

triggered(string|null $eventName) : integer|array

Retrieves the number of times an event was triggered, or the complete list of events that were triggered.

Parameters

string|null $eventName

The name of the event, if null returns the entire list of event that were fired

Returns

integer|array