Skip to content
Snippets Groups Projects
Unverified Commit a409094f authored by Andreas Gohr's avatar Andreas Gohr Committed by GitHub
Browse files

Merge pull request #2236 from splitbrain/AddSVGToButtons

feat: add optionally an SVG to html_btn
parents e6517f10 e824d633
No related branches found
No related tags found
No related merge requests found
......@@ -171,7 +171,6 @@ abstract class AbstractItem {
*
* Uses html_btn()
*
* @todo this does currently not support the SVG icon
* @return string
*/
public function asHtmlButton() {
......@@ -182,7 +181,8 @@ abstract class AbstractItem {
$this->getParams(),
$this->method,
$this->getTitle(),
$this->getLabel()
$this->getLabel(),
$this->getSvg()
);
}
......
......@@ -188,9 +188,10 @@ function html_topbtn(){
* @param string $method
* @param string $tooltip
* @param bool|string $label label text, false: lookup btn_$name in localization
* @param string $svg (optional) svg code, inserted into the button
* @return string
*/
function html_btn($name, $id, $akey, $params, $method='get', $tooltip='', $label=false){
function html_btn($name, $id, $akey, $params, $method='get', $tooltip='', $label=false, $svg=null){
global $conf;
global $lang;
......@@ -233,7 +234,12 @@ function html_btn($name, $id, $akey, $params, $method='get', $tooltip='', $label
$ret .= 'accesskey="'.$akey.'" ';
}
$ret .= 'title="'.$tip.'">';
$ret .= hsc($label);
if ($svg) {
$ret .= '<span>' . hsc($label) . '</span>';
$ret .= inlineSVG($svg);
} else {
$ret .= hsc($label);
}
$ret .= '</button>';
$ret .= '</div></form>';
......@@ -2314,4 +2320,4 @@ function html_sizechange($sizechange, Doku_Form $form) {
$form->addElement($value);
$form->addElement(form_makeCloseTag('span'));
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment