diff --git a/MenuItem.php b/MenuItem.php index 1d48e55..3a6f097 100644 --- a/MenuItem.php +++ b/MenuItem.php @@ -9,9 +9,11 @@ class MenuItem extends AbstractItem { * Generate a menu item from a passed string * * @param string $type + * @param string $label */ - public function __construct(string $type) { + public function __construct(string $type, string $label) { $this->type = $type; + $this->label = $label; parent::__construct(); trigger_error("generating a menu item for type \"$this->type\" not implemented in ".get_class($this), E_USER_WARNING); } diff --git a/action.php b/action.php index 202bff9..c4060bb 100644 --- a/action.php +++ b/action.php @@ -46,9 +46,10 @@ class action_plugin_childrenpages extends DokuWiki_Action_Plugin { return; } // Get the list of children pages - $children = [ 'animation', 'gameplay', 'dev', 'talk' ]; - foreach ( $children as $child ) { - $this->addMenuItem($event, $child); + $children_types = [ 'animation', 'gameplay', 'dev', 'talk' ]; + foreach ( $children_types as $child_type ) { + $child_label = $this->getLang("btn_$child_type"); + $this->addMenuItem($event, $child_type, $child_label); } } @@ -56,10 +57,11 @@ class action_plugin_childrenpages extends DokuWiki_Action_Plugin { * Add a new item to the page menu * * @param Doku_Event $event - * @param string $child + * @param string $type + * @param string $name */ - protected function addMenuItem(Doku_Event $event, string $child) { - $item = $this->generateMenuItem($child); + protected function addMenuItem(Doku_Event $event, string $type, string $name) { + $item = $this->generateMenuItem($type, $name); $event->data['items'][] = $item; } @@ -68,7 +70,7 @@ class action_plugin_childrenpages extends DokuWiki_Action_Plugin { * * @param string $type */ - protected function generateMenuItem(string $type) { - return new MenuItem($type); + protected function generateMenuItem(string $type, string $name) { + return new MenuItem($type, $name); } } diff --git a/lang/en/lang.php b/lang/en/lang.php new file mode 100644 index 0000000..7be973b --- /dev/null +++ b/lang/en/lang.php @@ -0,0 +1,6 @@ +