Skip to content

Commit a8135b8

Browse files
committed
Bootstrap Buttons
1 parent 55836b5 commit a8135b8

1 file changed

Lines changed: 13 additions & 33 deletions

File tree

catalog/includes/functions/html_output.php

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ function tep_get_country_list($name, $selected = '', $parameters = '') {
337337

338338
////
339339
// Output a jQuery UI Button
340-
function tep_draw_button($title = null, $icon = null, $link = null, $priority = null, $params = null) {
340+
function tep_draw_button($title = null, $icon = null, $link = null, $priority = null, $params = null, $class = null) {
341341
static $button_counter = 1;
342342

343343
$types = array('submit', 'button', 'reset');
@@ -354,11 +354,7 @@ function tep_draw_button($title = null, $icon = null, $link = null, $priority =
354354
$params['type'] = 'button';
355355
}
356356

357-
if (!isset($priority)) {
358-
$priority = 'secondary';
359-
}
360-
361-
$button = '<span class="tdbLink">';
357+
$button = NULL;
362358

363359
if ( ($params['type'] == 'button') && isset($link) ) {
364360
$button .= '<a id="tdb' . $button_counter . '" href="' . $link . '"';
@@ -373,41 +369,25 @@ function tep_draw_button($title = null, $icon = null, $link = null, $priority =
373369
if ( isset($params['params']) ) {
374370
$button .= ' ' . $params['params'];
375371
}
372+
373+
$button .= ' class="btn ';
374+
$button .= (isset($class)) ? $class : 'btn-default';
375+
$button .= '"';
376+
377+
$button .= '>';
378+
379+
if (isset($icon) && tep_not_null($icon)) {
380+
$button .= ' <span class="' . $icon . '"></span> ';
381+
}
376382

377-
$button .= '>' . $title;
383+
$button .= $title;
378384

379385
if ( ($params['type'] == 'button') && isset($link) ) {
380386
$button .= '</a>';
381387
} else {
382388
$button .= '</button>';
383389
}
384390

385-
$button .= '</span><script type="text/javascript">$("#tdb' . $button_counter . '").button(';
386-
387-
$args = array();
388-
389-
if ( isset($icon) ) {
390-
if ( !isset($params['iconpos']) ) {
391-
$params['iconpos'] = 'left';
392-
}
393-
394-
if ( $params['iconpos'] == 'left' ) {
395-
$args[] = 'icons:{primary:"ui-icon-' . $icon . '"}';
396-
} else {
397-
$args[] = 'icons:{secondary:"ui-icon-' . $icon . '"}';
398-
}
399-
}
400-
401-
if (empty($title)) {
402-
$args[] = 'text:false';
403-
}
404-
405-
if (!empty($args)) {
406-
$button .= '{' . implode(',', $args) . '}';
407-
}
408-
409-
$button .= ').addClass("ui-priority-' . $priority . '").parent().removeClass("tdbLink");</script>';
410-
411391
$button_counter++;
412392

413393
return $button;

0 commit comments

Comments
 (0)