\apex\app\pkgpackage_config

Handles package configuration files (/etc/ALIAS/package.php), installation loading and installation of all components within

Summary

Methods
Properties
Constants
__construct()
load()
install_configuration()
update_redis_menus()
install_default_dashboard_items()
install_notifications()
install_composer_dependencies()
scan_workers()
$pkg_alias
$pkg_dir
No constants found
install_config_vars()
install_hashes()
install_menus()
add_single_menu()
get_menu_position()
menu_get_current_position_row()
install_boxlists()
install_placeholders()
install_dashboard_items()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$pkg_alias

$pkg_alias :

Type

$pkg_dir

$pkg_dir :

Type

Methods

__construct()

__construct(string  $pkg_alias = '')

Construct

Parameters

string $pkg_alias

The alias of the package to load / manage

load()

load()

Load package configuration

Loads a package configuration file, and ensures any omitted arrays within package configuration are set as blank arrays to avoid errors in the rest of the class.

install_configuration()

install_configuration(mixed  $pkg = '')

Install / update package configuration

Goes through the package.php configuration file, and updates the database as necessary. Ensures to update existing records as necessary, and delete records that have been removed from the package.php file.

Parameters

mixed $pkg

The loaded package configuration.

update_redis_menus()

update_redis_menus()

Update menus in redis

Update menus in the redis database

install_default_dashboard_items()

install_default_dashboard_items(  $pkg)

Install default dashboard items

Parameters

$pkg

install_notifications()

install_notifications(mixed  $pkg)

Install notificationsl. Only executed during initial package install, and never again.

Parameters

mixed $pkg

The loaded package configuration.

install_composer_dependencies()

install_composer_dependencies(object  $pkg)

Install composer dependencies

Parameters

object $pkg

The loaded package objct.

scan_workers()

scan_workers()

Scan workers

install_config_vars()

install_config_vars(mixed  $pkg)

Install configuration variables

Adds / updates the configuration variables as necessary from the package.php $this->config() array.

Parameters

mixed $pkg

The loaded package configuration.

install_hashes()

install_hashes(mixed  $pkg)

Install hashes

Adds / updates / deletes the hashes within the package.php file's $this->hash array. Hashes are used as key-value paris to easily populate select / radio / checkbox lists.

Parameters

mixed $pkg

The loaded package configuration.

install_menus()

install_menus(mixed  $pkg)

Install menus

Adds / updates all menus within the package.php configuration file.

Parameters

mixed $pkg

The loaded package configuration.

add_single_menu()

add_single_menu(string  $area,string  $parent,string  $alias,string  $name,string  $position = 'bottom',string  $type = 'internal',string  $icon = '',string  $url = '',integer  $require_login,integer  $require_nologin)

Add / update single menu

Adds a single menu to the 'cms_menus' table, and is used by the above install_menu() function.

Parameters

string $area

The area the menu is for (usually 'admin', 'public', or 'members')

string $parent

The parent alias of the menu, used for sub-menus.

string $alias

The alias for the menu, used within the URI.

string $name

Optional display name. If omitted, ucwords($alias) is used.

string $position

The position of the menu. See documentation for details.

string $type

The type of menu. Can be: 'internal', 'parent', 'header', 'external''. Defaults to 'internal'.

string $icon

The icon of the menu, if applicab le (eg. fa fa-fw fa-users).

string $url

Only applicable for menus with type 'external', and is the URL destination of the menu.

integer $require_login

Whether or not login is required to display this menu. Used for public area to display different menus on public site depending whether user is logged in or not.

integer $require_nologin

Whether or not to only display this menu when not logged in.

get_menu_position()

get_menu_position(string  $area,string  $parent,string  $position): integer

Get menu position.

Gets the 'order_num' / position of a menu. Modifies the 'order_num' column as necessary to make room for the menu as well.

Parameters

string $area

The area the menu is in (eg. 'admin', 'public', or 'members')

string $parent

The parent alias of the menu, if it's a sub-menu.

string $position

The position of the menu. See documentation for details.

Returns

integer —

The 'order_num' of the menu.

menu_get_current_position_row()

menu_get_current_position_row(string  $area,string  $alias,string  $position,string  $parent = ''): array

Get current menu row / position

Get the current menu row, where our new menu is going to be placed. Used in case if new menu is before / after a header row, to get the next / last header row.

Parameters

string $area

The area of the menu (admin, members, etc.)

string $alias

The alias of the menu we're looking for

string $position

Must be either 'before' or 'after'

string $parent

The alias of the parent menu, if applicable

Returns

array —

The current menu row, or false if one is not found

install_boxlists()

install_boxlists(mixed  $pkg)

Install boxlists

Installs / updates the boxlists from the package.php configuration file. These are generally used for settings pages, such as user / financial settings in the admin panel.

Parameters

mixed $pkg

The loaded package configuration.

install_placeholders()

install_placeholders(mixed  $pkg)

Install placeholders

Parameters

mixed $pkg

The loaded package configuration.

install_dashboard_items()

install_dashboard_items(  $pkg)

Install dashboard items

Parameters

$pkg