$_cache : array
Block rendering dispatcher.
Each block has a
handler property which identifies the plugin that created
that Block, by default all blocks created using backend's administration page
Block has their handler.
An external plugin may register a custom block by inserting its information
directly in the "blocks" table and set an appropriate
Taxonomy plugin may create a new
Categories block by inserting
its information in the "blocks" table, this new block will have
its handler name.
Block's handler property is used to compose event's name that is triggered when block is being rendered (or edited). Event's name follows the pattern described below:
So all blocks with
Block as handler will trigger the event below when
The event described above is handled by this class. In the other hand, for
the Taxonomy example described above the following event will be triggered
when rendering the
Taxonomy plugin should catch this event and return a STRING.
handlername when registering blocks in the "blocks" table, the only constraint is that it must be unique in the entire "blocks" table. Use plugin's name itself is always a good practice as it's already unique in the whole system. Anyway, handler names such as
i-like-trainsare valid as well.
renderBlock(\Cake\Event\Event $event, \Block\Model\Entity\Block $block, array $options) : string
Block rendering dispatcher, renders the given block.
This method will delegate the rendering task to block's handler by triggering
Block.<handler>.display event, or the event
Block.<handler>.display<CamelizedDelta>, where "CamelizedDelta" is delta's
Block.<handler>.displayMyDeltaName (for block's delta
If such event does not exists it will look for certain view elements when
rendering each block, if one of this elements is not present it'll look the
next one, and so on. These view elements should be defined by Themes by
placing them in
Renders the given block based on theme's region-name and view-mode, for example:
render_block_left-sidebar_full.ctp: Render for blocks in
region when view-mode is
render_block_left-sidebar_search-result.ctp: Render for blocks in
left-sidebar region when view-mode is
footerregion when view-mode is
Similar as before, but based on theme's region-name (and any view-mode), for example:
render_block_right-sidebar.ctp: Render for blocks in
This is the global render, if none of the above renders is found we try to
use this last. Themes can overwrite this view element by creating a new one
NOTE: Please note the difference between "_" and "-"
The event that was triggered
Block entity to be rendered
Additional options, will be passed to the template element being rendered
The rendered block
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
EventName within that instance.
The event name to trigger
The event object that was fired
eventDispatcher(string $name) : \QuickApps\Event\EventDispatcher
Gets an instance of the given Event Dispatcher name.
$this->eventDispatcher('myDispatcher') ->trigger('MyEventName', $argument) ->result;
Name of the dispatcher to get, defaults to 'default'
triggered(string|null $eventName) : integer|array
Retrieves the number of times an event was triggered, or the complete list of events that were triggered.
The name of the event, if null returns the entire list of event that were fired
cache(null|string $key, mixed $value) : mixed
Reads, writes or search internal class's cache.
$null = static::cache('invalid-key');
$value = static::cache('key', 'value');
$allCache = static::cache()
$key = static::cache(null, 'search key for this value'), if no key for the given value is found NULL will be returned.
static::cache('user_name', 'John'); // returns 'John' static::cache('user_last', 'Locke'); // returns 'Locke'
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']
static::cache(null, 'Locke'); // returns: user_last static::cache(null, 'Unexisting Value'); // returns: null
Cache key to read or write, set both $key and $value to get the whole cache information
Values to write into the given $key, or null indicates reading from cache