Generate a label from the item type if none is provided
This commit is contained in:
parent
60f3dfe08f
commit
71295a3ec3
2 changed files with 6 additions and 3 deletions
|
@ -11,9 +11,12 @@ class MenuItem extends AbstractItem {
|
|||
* @param string $type
|
||||
* @param string $label
|
||||
*/
|
||||
public function __construct(string $type, string $label) {
|
||||
public function __construct(string $type, string $label = '') {
|
||||
global $INFO;
|
||||
$this->type = $type;
|
||||
if ( empty($label) ) {
|
||||
$label = ucfirst($type);
|
||||
}
|
||||
$this->label = $label;
|
||||
parent::__construct();
|
||||
// Edit the item to show a link to the requested children page
|
||||
|
|
|
@ -60,7 +60,7 @@ class action_plugin_childrenpages extends DokuWiki_Action_Plugin {
|
|||
* @param string $type
|
||||
* @param string $name
|
||||
*/
|
||||
protected function addMenuItem(Doku_Event $event, string $type, string $name) {
|
||||
protected function addMenuItem(Doku_Event $event, string $type, string $name = '') {
|
||||
$item = $this->generateMenuItem($type, $name);
|
||||
$event->data['items'][] = $item;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ class action_plugin_childrenpages extends DokuWiki_Action_Plugin {
|
|||
*
|
||||
* @param string $type
|
||||
*/
|
||||
protected function generateMenuItem(string $type, string $name) {
|
||||
protected function generateMenuItem(string $type, string $name = '') {
|
||||
return new MenuItem($type, $name);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue