\Taxonomy\Controller\AdminVocabulariesController

Vocabularies manager controller.

Allow CRUD for vocabularies.

Summary

Methods
Properties
Constants
index()
add()
edit()
delete()
__construct()
isAction()
title()
description()
prepareTheme()
checkMaintenanceMode()
trigger()
eventDispatcher()
triggered()
viewMode()
addViewMode()
viewModes()
onViewMode()
asViewMode()
$theme
$layout
$viewClass
$components
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$theme

$theme : string

In use theme name.

Type

string

$layout

$layout : string

Name of the layout that should be used by current theme.

Type

string

$viewClass

$viewClass : string

The name of the View class controllers sends output to.

Type

string

$components

$components : array

An array containing the names of components controllers uses.

Type

array

Methods

index()

index() : void

Shows a list of all vocabularies.

add()

add() : void

Adds a new menu.

edit()

edit(integer $id) : void

Edits the given vocabulary by ID.

Parameters

integer $id

Vocabulary's ID

delete()

delete(integer $id) : void

Removes the given vocabulary by ID.

Parameters

integer $id

Vocabulary's ID

__construct()

__construct(\Cake\Network\Request $request, \Cake\Network\Response $response)

Constructor.

Parameters

\Cake\Network\Request $request

Request object for this controller. Can be null for testing, but expect that features that use the request parameters will not work.

\Cake\Network\Response $response

Response object for this controller.

isAction()

isAction(string $action) : boolean

Method to check that an action is accessible from a URL.

Override this method to change which controller methods can be reached. The default implementation disallows access to all methods defined on Cake\Controller\Controller or QuickApps\Controller\Controller, and allows all public methods on all subclasses of this class.

Parameters

string $action

The action to check.

Returns

boolean —

Whether or not the method is accessible from a URL.

title()

title(string $titleForLayout) : void

Shortcut for Controller::set('title_for_layout', .

..)

Parameters

string $titleForLayout

The title to use on layout's title tag

description()

description(string $descriptionForLayout) : void

Shortcut for Controller::set('description_for_layout', .

..)

Parameters

string $descriptionForLayout

The description to use as meta-description on layout's head tag

prepareTheme()

prepareTheme() : void

Sets the theme to use.

checkMaintenanceMode()

checkMaintenanceMode() : void

Checks if maintenance is enabled, and renders the corresponding maintenance message.

Login & logout sections of the site still working even on maintenance mode, administrators can access the whole site as well.

Throws

\QuickApps\Controller\QuickApps\Error\SiteUnderMaintenanceException

When site is under maintenance mode

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

viewMode()

viewMode(string|null $slug) : void

Sets a view mode or get current view mode.

Parameters

string|null $slug

Slug name of the view mode

addViewMode()

addViewMode(string|array $slug, string|null $name, string|null $description) : void

Registers a new view mode. Or overwrite if already exists.

Parameters

string|array $slug

Slug name of your view mode. e.g.: my-view mode. Or an array of view modes to register indexed by slug name

string|null $name

Human readable name. e.g.: My View Mode

string|null $description

A brief description about for what is this view mode

viewModes()

viewModes(boolean|string $viewMode) : array

Gets the full list of all registered view modes, or for a single view mode if $viewMode is set to a string value.

Parameters

boolean|string $viewMode

Set to true to get full list. Or false (by default) to get only the slug of all registered view modes. Or set to a string value to get information for that view mode only.

Returns

array

onViewMode()

onViewMode(string|array $viewMode, callable $method) : mixed

Runs the given callable when the in-use view mode matches.

You can provide multiple view modes, in that case callable method will be executed if current view mode matches any in the given array.

Usage

// run this only on `teaser` view mode
echo $this->onViewMode('teaser', function () use ($someVar) {
    return $this->element('teaser_element', compact('someVar'));
});

// run this on "teaser" view mode, or "search-result" view mode
echo $this->onViewMode(['teaser', 'search-result'], function () use ($someVar) {
    return $this->element('teaser_or_search_result', compact('someVar'));
});

Parameters

string|array $viewMode

View Mode slug, or an array of slugs

callable $method

A callable function to run, it receives $this as only argument

Returns

mixed —

Callable return

asViewMode()

asViewMode(string|array $viewMode, callable $method) : mixed

Runs the given callable as it were under the given view mode.

Usage

$this->viewMode('full');
echo 'before: ' . $this->viewMode();

echo $this->asViewMode('teaser', function () {
     echo 'callable: ' . $this->viewMode();
});

echo 'after: ' . $this->viewMode();

// output:
// before: full
// callable: teaser
// after: full

Parameters

string|array $viewMode

View Mode slug, or an array of slugs

callable $method

A callable function to run, it receives $this as only argument

Returns

mixed —

Callable return