diff --git a/MenuItem.php b/MenuItem.php index 38cf2ca..4a1011b 100644 --- a/MenuItem.php +++ b/MenuItem.php @@ -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 diff --git a/action.php b/action.php index 2f2705e..e081f7f 100644 --- a/action.php +++ b/action.php @@ -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); } }