PHP 클래스 Piwik\Plugin\Menu

Descendants of this class can overwrite any of these methods. Each method will be executed only once per request and cached for any further menu requests. For an example, see the {@link https://github.com/piwik/piwik/blob/master/plugins/ExampleUI/Menu.php} plugin.
부터: 2.4.0
파일 보기 프로젝트 열기: piwik/piwik 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( )
configureAdminMenu ( MenuAdmin $menu ) Configures the admin menu which is supposed to contain only administration related items such as "Websites", "Users" or "Settings".
configureTopMenu ( MenuTop $menu ) Configures the top menu which is supposed to contain analytics related items such as the "All Websites Dashboard".
urlForDefaultUserParams ( boolean $websiteId = false, boolean $defaultPeriod = false, boolean $defaultDate = false ) : string Returns the &idSite=X&period=Y&date=Z query string fragment, fetched from current logged-in user's preferences.

보호된 메소드들

메소드 설명
urlForAction ( string $controllerAction, array $additionalParams = [] ) : array Generates a URL for the given action. In your plugin controller you have to create a method with the same name as this method will be executed when a user clicks on the menu item. If you want to generate a URL for the action of another module, meaning not your plugin, you should use the method {@link urlForModuleAction()}.
urlForActionWithDefaultUserParams ( string $controllerAction, array $additionalParams = [] ) : array Generates a URL to the given action of the current module, and it will also append some URL query parameters from the User preferences: idSite, period, date. If you do not need the parameters idSite, period and date to be generated use {@link urlForAction()} instead.
urlForDefaultAction ( array $additionalParams = [] ) : array Generates a URL for the default action of the plugin controller.
urlForModuleAction ( string $module, string $controllerAction, array $additionalParams = [] ) : array | null Generates a URL for the given action of the given module. We usually do not recommend to use this method as you should make sure the method of that module actually exists. If the plugin owner of that module changes the method in a future version your link might no longer work. If you want to link to an action of your controller use the method {@link urlForAction()}. Note: We will generate a link only if the given module is installed and activated.
urlForModuleActionWithDefaultUserParams ( string $module, string $controllerAction, array $additionalParams = [] ) : array | null Generates a URL to the given action of the given module, and it will also append some URL query parameters from the User preferences: idSite, period, date. If you do not need the parameters idSite, period and date to be generated use {@link urlForModuleAction()} instead.

비공개 메소드들

메소드 설명
checkisValidCallable ( $module, $action )
getModule ( )

메소드 상세

__construct() 공개 메소드

public __construct ( )

configureAdminMenu() 공개 메소드

Configures the admin menu which is supposed to contain only administration related items such as "Websites", "Users" or "Settings".
public configureAdminMenu ( MenuAdmin $menu )
$menu Piwik\Menu\MenuAdmin

configureTopMenu() 공개 메소드

Configures the top menu which is supposed to contain analytics related items such as the "All Websites Dashboard".
public configureTopMenu ( MenuTop $menu )
$menu Piwik\Menu\MenuTop

urlForAction() 보호된 메소드

Generates a URL for the given action. In your plugin controller you have to create a method with the same name as this method will be executed when a user clicks on the menu item. If you want to generate a URL for the action of another module, meaning not your plugin, you should use the method {@link urlForModuleAction()}.
부터: 2.7.0
protected urlForAction ( string $controllerAction, array $additionalParams = [] ) : array
$controllerAction string The name of the action that should be executed within your controller
$additionalParams array Optional URL parameters that will be appended to the URL
리턴 array

urlForActionWithDefaultUserParams() 보호된 메소드

Generates a URL to the given action of the current module, and it will also append some URL query parameters from the User preferences: idSite, period, date. If you do not need the parameters idSite, period and date to be generated use {@link urlForAction()} instead.
protected urlForActionWithDefaultUserParams ( string $controllerAction, array $additionalParams = [] ) : array
$controllerAction string The name of the action that should be executed within your controller
$additionalParams array Optional URL parameters that will be appended to the URL
리턴 array Returns the array of query parameter names and values to the given module action and idSite date and period.

urlForDefaultAction() 보호된 메소드

Example: $menu->addItem('UI Framework', '', $this->urlForDefaultAction(), $orderId = 30); will add a menu item that leads to the default action of the plugin controller when a user clicks on it. The default action is usually the index action - meaning the index() method the controller - but the default action can be customized within a controller
부터: 2.7.0
protected urlForDefaultAction ( array $additionalParams = [] ) : array
$additionalParams array Optional URL parameters that will be appended to the URL
리턴 array

urlForDefaultUserParams() 공개 메소드

Returns the &idSite=X&period=Y&date=Z query string fragment, fetched from current logged-in user's preferences.
public urlForDefaultUserParams ( boolean $websiteId = false, boolean $defaultPeriod = false, boolean $defaultDate = false ) : string
$websiteId boolean
$defaultPeriod boolean
$defaultDate boolean
리턴 string eg '&idSite=1&period=week&date=today'

urlForModuleAction() 보호된 메소드

Generates a URL for the given action of the given module. We usually do not recommend to use this method as you should make sure the method of that module actually exists. If the plugin owner of that module changes the method in a future version your link might no longer work. If you want to link to an action of your controller use the method {@link urlForAction()}. Note: We will generate a link only if the given module is installed and activated.
부터: 2.7.0 // not API for now
protected urlForModuleAction ( string $module, string $controllerAction, array $additionalParams = [] ) : array | null
$module string The name of the module/plugin the action belongs to. The module name is case sensitive.
$controllerAction string The name of the action that should be executed within your controller
$additionalParams array Optional URL parameters that will be appended to the URL
리턴 array | null Returns null if the given module is either not installed or not activated. Returns the array of query parameter names and values to the given module action otherwise.

urlForModuleActionWithDefaultUserParams() 보호된 메소드

Generates a URL to the given action of the given module, and it will also append some URL query parameters from the User preferences: idSite, period, date. If you do not need the parameters idSite, period and date to be generated use {@link urlForModuleAction()} instead.
protected urlForModuleActionWithDefaultUserParams ( string $module, string $controllerAction, array $additionalParams = [] ) : array | null
$module string The name of the module/plugin the action belongs to. The module name is case sensitive.
$controllerAction string The name of the action that should be executed within your controller
$additionalParams array Optional URL parameters that will be appended to the URL
리턴 array | null Returns the array of query parameter names and values to the given module action and idSite date and period. Returns null if the module or action is invalid.