本文整理汇总了PHP中custom_menu_item::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP custom_menu_item::__construct方法的具体用法?PHP custom_menu_item::__construct怎么用?PHP custom_menu_item::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类custom_menu_item
的用法示例。
在下文中一共展示了custom_menu_item::__construct方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(custom_menu_item $menunode)
{
parent::__construct($menunode->get_text(), $menunode->get_url(), $menunode->get_title(), $menunode->get_sort_order(), $menunode->get_parent());
$this->children = $menunode->get_children();
$matches = array();
if (preg_match('/^\\[\\[([a-zA-Z0-9\\-\\_\\:]+)\\]\\]$/', $this->text, $matches)) {
try {
$this->text = get_string($matches[1], 'theme_rocket');
} catch (Exception $e) {
$this->text = $matches[1];
}
}
$matches = array();
if (preg_match('/^\\[\\[([a-zA-Z0-9\\-\\_\\:]+)\\]\\]$/', $this->title, $matches)) {
try {
$this->title = get_string($matches[1], 'theme_rocket');
} catch (Exception $e) {
$this->title = $matches[1];
}
}
}
示例2: __construct
/**
* Creates the custom menu
*
* @param string $definition the menu items definition in syntax required by {@link convert_text_to_menu_nodes()}
* @param string $currentlanguage the current language code, null disables multilang support
*/
public function __construct($definition = '', $currentlanguage = null)
{
$this->currentlanguage = $currentlanguage;
parent::__construct('root');
// create virtual root element of the menu
if (!empty($definition)) {
$this->override_children(self::convert_text_to_menu_nodes($definition, $currentlanguage));
}
}
示例3: __construct
/**
* Creates the custom menu
* @param string $text Sets the text for this custom menu, never gets used and is optional
*/
public function __construct($text='base') {
global $CFG;
parent::__construct($text);
if (!empty($CFG->custommenuitems)) {
$this->override_children(self::convert_text_to_menu_nodes($CFG->custommenuitems));
}
}