diff options
author | Andreas Gohr <andi@splitbrain.org> | 2017-09-02 17:25:22 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2017-09-02 17:27:59 +0200 |
commit | b965a044783079da3e1a393527e2f7b92eb15c2d (patch) | |
tree | 83e5682188723ea22dbf54861f7718c30435c729 /inc/Menu | |
parent | 50ca245c235eb2ced9a0897638df2d5c0a12b55d (diff) | |
download | dokuwiki-b965a044783079da3e1a393527e2f7b92eb15c2d.tar.gz dokuwiki-b965a044783079da3e1a393527e2f7b92eb15c2d.zip |
added convenience method to display item as button
Diffstat (limited to 'inc/Menu')
-rw-r--r-- | inc/Menu/Item/AbstractItem.php | 20 | ||||
-rw-r--r-- | inc/Menu/Item/Top.php | 12 |
2 files changed, 32 insertions, 0 deletions
diff --git a/inc/Menu/Item/AbstractItem.php b/inc/Menu/Item/AbstractItem.php index 1f3574776..03ec29afb 100644 --- a/inc/Menu/Item/AbstractItem.php +++ b/inc/Menu/Item/AbstractItem.php @@ -167,6 +167,26 @@ abstract class AbstractItem { } /** + * Convenience method to create a <button> element inside it's own form element + * + * Uses html_btn() + * + * @todo this does currently not support the SVG icon + * @return string + */ + public function asHtmlButton() { + return html_btn( + $this->getType(), + $this->id, + $this->getAccesskey(), + $this->getParams(), + $this->method, + $this->getTitle(), + $this->getLabel() + ); + } + + /** * Should this item be shown in the given context * * @param int $ctx the current context diff --git a/inc/Menu/Item/Top.php b/inc/Menu/Item/Top.php index a7e4cb24b..a05c4f119 100644 --- a/inc/Menu/Item/Top.php +++ b/inc/Menu/Item/Top.php @@ -21,4 +21,16 @@ class Top extends AbstractItem { $this->context = self::CTX_DESKTOP; } + /** + * Convenience method to create a <button> element + * + * Uses html_topbtn() + * + * @todo this does currently not support the SVG icon + * @return string + */ + public function asHtmlButton() { + return html_topbtn(); + } + } |