1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-18 05:09:05 +01:00

Merge pull request #2549 from Jimmi08/patch-12

possibility to format page button shortcode
This commit is contained in:
Cameron 2017-04-09 13:52:02 -07:00 committed by GitHub
commit 544f1a307e

View File

@ -249,6 +249,12 @@ class cpage_shortcodes extends e_shortcode
return '<a class="cpage" href="'.$url.'">'.$this->sc_cpagetitle().'</a>';
}
/**
* @param null $parm
* @example {CPAGEBUTTON}
* @example {CPAGEBUTTON: class=btn large default mb&target=blank}
* @return string
*/
function sc_cpagebutton($parm)
{
$tp = e107::getParser();
@ -290,7 +296,10 @@ class cpage_shortcodes extends e_shortcode
$inc = ($size) ? " btn-".$size : "";
return '<a class="cpage btn btn-primary btn-cpage'.$inc.'" href="'.$buttonUrl.'" '.$buttonTarget.'>'.$text.'</a>';
$class = (!empty($options['class'])) ? $options['class'] : 'cpage btn btn-primary btn-cpage';
$buttonTarget = (!empty($options['target'])) ? ' target="'.$options['target'].'" ' : $buttonTarget;
return '<a class="'.$class.' '.$inc.'" href="'.$buttonUrl.'" '.$buttonTarget.'>'.$text.'</a>';
}