Settings menu class

access public
package kocuj_internal_lib
inherited_from \KocujIL\V12a\Classes\ComponentObject

 Methods

Call handler for non-existing methods

__call(string $name, array $arguments) : array | boolean | float | integer | string | void
access public

Parameters

$name

string

Method name

$arguments

Returns

arraybooleanfloatintegerstringvoidValue returned by called method

Constructor

__construct(object $projectObj) : void
Inherited
access public

Parameters

$projectObj

object

\KocujIL\V12a\Classes\Project object for current project

Action for adding menu

actionAdminMenu() : void
access public

Add settings menu

addSettingsMenu(string $title, string $capability, string $id, array|string $function, string $parentId = '', integer $type = \KocujIL\V12a\Enums\Project\Components\Backend\SettingsMenu\Type::SITE, array $attr = array()) : void
access public

Parameters

$title

string

Menu title

$capability

string

Capability required for access to this menu

$id

string

Menu id

$function

arraystring

Callback function or method name; can be global function or method from any class

$parentId

string

Parent menu identifier - default: empty

$type

integer

Menu type - site or network; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\SettingsMenu\Type: SITE or NETWORK - default: \KocujIL\V12a\Enums\Project\Components\Backend\SettingsMenu\Type::SITE

$attr

array

Additional attributes; there are available the following attributes: "firstoptiontitle" (title for first option if current option menu is without parent; only for menu - not submenu), "fulltitle" (string type; full title of page), "icon" (string type; icon name for settings option; only for menu - not submenu), "onpluginslist" (bool type; there will be link to this settings on this plugin information in plugins list with title from this option or from "pluginslisttitle" attribute if exists), "pluginslisttitle" (string type; title of plugin if "onpluginslist" is set to true) - default: empty

Add settings menu to built in menu

addSettingsMenuBuiltIn(string $title, string $capability, string $id, array|string $function, integer $parentType = \KocujIL\V12a\Enums\Project\Components\Backend\SettingsMenu\ParentType::DASHBOARD, array $attr = array()) : void
access public

Parameters

$title

string

Menu title

$capability

string

Capability required for access to this menu

$id

string

Menu id

$function

arraystring

Callback function or method name; can be global function or method from any class

$parentType

integer

Parent menu type; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\SettingsMenu\ParentType: DASHBOARD, POSTS, MEDIA, LINKS, PAGES, COMMENTS, THEMES, PLUGINS, USERS, TOOLS, NETWORK_DASHBOARD, NETWORK_SITES, NETWORK_USERS, NETWORK_THEMES, NETWORK_PLUGINS or NETWORK_OPTIONS - default: \KocujIL\V12a\Enums\Project\Components\Backend\SettingsMenu\ParentType::DASHBOARD

$attr

array

Additional attributes; there are available the following attributes: "firstoptiontitle" (title for first option if current option menu is without parent; only for menu - not submenu), "fulltitle" (string type; full title of page), "icon" (string type; icon name for settings option; only for menu - not submenu), "onpluginslist" (bool type; there will be link to this settings on this plugin information in plugins list with title from this option or from "pluginslisttitle" attribute if exists), "pluginslisttitle" (string type; title of plugin if "onpluginslist" is set to true) - default: empty

Check if current page is for settings for current project

checkCurrentPageIsSettingsForProject() : boolean
access public

Returns

booleanCurrent page is for settings for current project (true) or not (false)

Check if settings menu exists

checkSettingsMenu(string $id) : boolean
access public

Parameters

$id

string

Settings menu identifier

Returns

booleanSettings menu exists (true) or not (false)

Get object of class type from component

getComponent(string $type, integer $projectCategory = \KocujIL\V12a\Enums\ProjectCategory::CORE, string $fragment = '') : object
Inherited
access public

Parameters

$type

string

Component type

$projectCategory

integer

Component category; must be one of the following constants from \KocujIL\V12a\Enums\ProjectCategory: CORE (for "core" category), ALL (for "all" category), FRONTEND (for "frontend" category) or BACKEND (for "backend" category) - default: \KocujIL\V12a\Enums\ProjectCategory::CORE

$fragment

string

Component fragment - default: empty

Returns

objectObject of class type from component

Get current settings menu page

getCurrentSettingsMenu() : boolean | string
access public

Returns

booleanstringCurrent settings menu page or false if it is not page for current project

Get object of type \KocujIL\V12a\Classes\Project

getProjectObj() : object
Inherited
access public

Returns

objectObject of type \KocujIL\V12a\Classes\Project

Get the selected settings menu data

getSettingsMenu(string $id) : array | boolean
access public

Parameters

$id

string

Settings menu identifier

Returns

arraybooleanSelected setting menu data or false if not exists; each settings menu data has the following fields: "alternativepagescreenname" (string type; alternative screen name for this page), "capability" (string type; capability required for access to this menu), "firstoptiontitle" (string type; title for first option if current option menu is without parent; only for menu - not submenu), "function" (array or string type; callback function or method name), "icon" (string type; icon name for settings option; only for menu - not submenu), "menutype" (int type; it is one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\SettingsMenu\Type: SITE or NETWORK), "onpluginslist" (bool type; there will be link to this settings on this plugin information in plugins list with title from this option or from "pluginslisttitle" attribute if exists), "pagescreenname" (string type; screen name for this page), "pluginslisttitle" (string type; title of plugin if "onpluginslist" is set to true), "title" (string type; menu title)

Get hook suffix for the selected settings menu

getSettingsMenuHookSuffix(string $id) : boolean | string
access public

Parameters

$id

string

Settings menu identifier

Returns

booleanstringHook suffix for the selected settings menu or false if not exists

Get settings menus data

getSettingsMenus() : array
access public

Returns

arraySettings menus data; each settings menu data has the following fields: "alternativepagescreenname" (string type; alternative screen name for this page), "capability" (string type; capability required for access to this menu), "firstoptiontitle" (string type; title for first option if current option menu is without parent; only for menu - not submenu), "function" (array or string type; callback function or method name), "icon" (string type; icon name for settings option; only for menu - not submenu), "menutype" (int type; it is one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\SettingsMenu\Type: SITE or NETWORK), "onpluginslist" (bool type; there will be link to this settings on this plugin information in plugins list with title from this option or from "pluginslisttitle" attribute if exists), "pagescreenname" (string type; screen name for this page), "pluginslisttitle" (string type; title of plugin if "onpluginslist" is set to true), "title" (string type; menu title)

Get object of class type for strings from component

getStrings(string $type, integer $projectCategory = \KocujIL\V12a\Enums\ProjectCategory::CORE) : object
Inherited
access public

Parameters

$type

string

Component type

$projectCategory

integer

Component category; must be one of the following constants from \KocujIL\V12a\Enums\ProjectCategory: CORE (for "core" category), ALL (for "all" category), FRONTEND (for "frontend" category) or BACKEND (for "backend" category) - default: \KocujIL\V12a\Enums\ProjectCategory::CORE

Returns

objectObject of class type for strings from component

Remove settings menu

removeSettingsMenu(string $id) : void
access public

Parameters

$id

string

Settings menu identifier

Add settings menu, submenu or submenu to built-in menu

addSettingsMenuOrSubmenu(string $title, string $capability, string $id, array|string $function, boolean $parentIsBuiltInMenu, string $parentId, integer $type, array $attr) : void
access private

Parameters

$title

string

Menu title

$capability

string

Capability required for access to this menu

$id

string

Menu id

$function

arraystring

Callback function or method name; can be global function or method from any class

$parentIsBuiltInMenu

boolean

Parent is built-in menu (true) or is settings menu for this project if exists (false)

$parentId

string

Parent menu identifier (if $parentIsBuiltInMenu=false) or parent menu type (if $parentIsBuiltInMenu=true); for parent menu type it must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\SettingsMenu\ParentType: DASHBOARD, POSTS, MEDIA, LINKS, PAGES, COMMENTS, THEMES, PLUGINS, USERS, TOOLS, NETWORK_DASHBOARD, NETWORK_SITES, NETWORK_USERS, NETWORK_THEMES, NETWORK_PLUGINS or NETWORK_OPTIONS - default: \KocujIL\V12a\Enums\Project\Components\Backend\SettingsMenu\ParentType::DASHBOARD

$type

integer

Menu type - site or network; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\SettingsMenu\Type: SITE or NETWORK

$attr

array

Additional attributes; there are available the following attributes: "firstoptiontitle" (title for first option if current option menu is without parent; only for menu - not submenu), "fulltitle" (string type; full title of page), "icon" (string type; icon name for settings option; only for menu - not submenu), "onpluginslist" (bool type; there will be link to this settings on this plugin information in plugins list with title from this option or from "pluginslisttitle" attribute if exists), "pluginslisttitle" (string type; title of plugin if "onpluginslist" is set to true)

Show title button

showTitleButton(string $id, string $link, string $text) : void
access private

Parameters

$id

string

Button identifier

$link

string

Button link

$text

string

Button text

 Properties

 

Settings alternative pages screen names

$alternativePageScreenNames : array

Default

array()
access private
 

Settings pages screen names

$pageScreenNames : array

Default

array()
access private
 

\KocujIL\V12a\Classes\Project object for current project

$projectObj : object

Default

NULL
access private
 

Settings menus list

$settingsMenu : array

Default

array()
access private
 

Settings menus hooks suffixes

$settingsMenuHookSuffix : array

Default

array()
access private