To obtain an instance of this class, call method wa->getConfig()
; e.g.:
wa->getConfig()->getName();
Methods
-
getAppConfigPath
Returns path to specified configuration file.
-
getApplication
Returns app's id.
-
getAppPath
Returns path to app's source files.
-
getConfigPath
Returns path to app's configuration file.
-
getInfo
Returns information from app's file
lib/config/app.php
. -
getName
Returns app's name from its configuration file
lib/config/app.php
. -
getOption
Returns app configuration parameter values.
-
getPluginInfo
Returns information about an installed plugin of an app.
-
getPluginPath
Returns path to the source files of an installed app plugin.
-
getPlugins
Returns information about all installed plugins of an app.
-
setCount
Sets or clears the value of an app's indicator displayed next to its icon in the main backend menu.
public function getAppConfigPath ($name)
Returns path to specified configuration file of an app, located in lib/config/
directory.
Parameters
-
$name
Имя файла.
Example
$app_config = wa()->getConfig()->getAppConfig('blog'); $app_config->getAppConfigPath('routing');
Result
/var/www/wa-apps/blog/lib/config/routing.php
public function getApplication()
Returns app's id.
Example
$app_config = wa()->getConfig()->getAppConfig('blog'); $app_config->getApplication();
Result
blog
public function getAppPath ($path = null)
Returns path to app's source files.
Parameters
-
$path
Optional path to a subdirectory inside app's directory
wa-apps/[app_id]/lib/
.
Example
$app_config = wa()->getConfig()->getAppConfig('blog'); $app_config->getAppPath('templates/');
Result
/var/www/wa-apps/blog/templates/
public function getConfigPath ($name, $user_config = true, $app = null)
Returns path to app's configuration file.
Parameters
-
$name
Name of the configuration file whose path must be returned.
-
$user_config
Flag requiring to return the path to a file in directory
wa-config/apps/[app_id]/
, which is used for storing custom user configuration. Iffalse
is specified, the method will return path to a file located in directorywa-apps/[app_id]/lib/config/
. -
$app
The id of the app whose configuration file's path must be returned. If not specified, the current app's id is used by default.
Example
$app_config = wa()->getConfig()->getAppConfig('blog'); $app_config->getConfigPath('routing.php', false);
Result
/var/www/wa-apps/blog/lib/config/routing.php
public function getInfo ($name = null)
Returns information from app's file lib/config/app.php
.
Parameters
-
$name
Name of the parameter whose value must be returned. If not specified, the method returns an associative array of all parameters contained in the configuration file.
Example
$app_config = wa()->getConfig()->getAppConfig('blog'); $app_config->getInfo('name');
Result
Blog
public function getName()
Returns app's name from its configuration file lib/config/app.php
.
Example
$app_config = wa()->getConfig()->getAppConfig('blog'); $app_config->getName();
Result
Blog
public function getOption ($name = null)
Returns app configuration parameter values.
Parameters
-
$name
The name of the configuration parameter whose value must be returned.
Example
$app_config = wa()->getConfig()->getAppConfig('blog'); $app_config->getOption('posts_per_page');
Result
10
public function getPluginInfo ($plugin_id)
Returns information about an installed plugin of an app.
Parameters
-
$plugin_id
Plugin id.
Example
$app_config = wa()->getConfig()->getAppConfig('shop'); $app_config->getPluginInfo('migrate');
Result
Array ( [name] => Migrate to Shop-Script [description] => Transfer data from other ecommerce platforms to Shop-Script [img] => wa-apps/shop/plugins/migrate/img/migrate.png [vendor] => webasyst [version] => 1.0.0 [importexport] => 1 [handlers] => Array ( ) [id] => migrate )
public function getPluginPath ($plugin_id)
Returns path to the source files of an installed app plugin.
Parameters
-
$plugin_id
Plugin id.
Example
$app_config = wa()->getConfig()->getAppConfig('shop'); $app_config->getPluginPath('migrate');
Result
/var/www/wa-apps/shop/plugins/migrate
public function getPlugins()
Returns information about all installed plugins of an app.
Example
$app_config = wa()->getConfig()->getAppConfig('blog'); $app_config->getPlugins();
Result
Array ( [watermark] => Array ( [name] => Watermark [description] => Applies watermark text or image on uploaded photos [img] => wa-apps/shop/plugins/yandexmarket/img/watermark.png [vendor] => webasyst [version] => 1.0.0 [rights] => false [handlers] => Array ( [image_upload] => imageUpload ) [id] => watermark ) [migrate] => Array ( [name] => Migrate to Shop-Script [description] => Transfer data from other ecommerce platforms to Shop-Script [img] => wa-apps/shop/plugins/migrate/img/migrate.png [vendor] => webasyst [version] => 1.0.0 [importexport] => 1 [handlers] => Array ( ) [id] => migrate ) )
public function setCount ($n = null)
Sets or clears the value of an app's indicator displayed next to its icon in the main backend menu.
Parameters
-
$n
Indicator value. If an empty value is specified, the indicator's value will be cleared.
Example
$app_config = wa()->getConfig()->getAppConfig('shop'); $app_config->setCount(100);