Permalink
Browse files

improve tep_draw_button()

  • Loading branch information...
1 parent 15601d2 commit 3468522144cab060f7ec058fbe793942f46bb641 @haraldpdl haraldpdl committed Sep 16, 2010
Showing with 24 additions and 4 deletions.
  1. +12 −2 catalog/admin/includes/functions/html_output.php
  2. +12 −2 catalog/includes/functions/html_output.php
@@ -378,18 +378,28 @@ function tep_draw_button($title = null, $icon = null, $link = null, $priority =
$button .= '>' . $title . '</button><script>$("#tdb' . $button_counter . '").button(';
+ $args = array();
+
if ( isset($icon) ) {
if ( !isset($params['iconpos']) ) {
$params['iconpos'] = 'left';
}
if ( $params['iconpos'] == 'left' ) {
- $button .= '{icons:{primary:"ui-icon-' . $icon . '"}}';
+ $args[] = 'icons:{primary:"ui-icon-' . $icon . '"}';
} else {
- $button .= '{icons:{secondary:"ui-icon-' . $icon . '"}}';
+ $args[] = 'icons:{secondary:"ui-icon-' . $icon . '"}';
}
}
+ if (empty($title)) {
+ $args[] = 'text:false';
+ }
+
+ if (!empty($args)) {
+ $button .= '{' . implode(',', $args) . '}';
+ }
+
$button .= ').addClass("ui-priority-' . $priority . '");</script>';
$button_counter++;
@@ -373,18 +373,28 @@ function tep_draw_button($title = null, $icon = null, $link = null, $priority =
$button .= '>' . $title . '</button><script>$("#tdb' . $button_counter . '").button(';
+ $args = array();
+
if ( isset($icon) ) {
if ( !isset($params['iconpos']) ) {
$params['iconpos'] = 'left';
}
if ( $params['iconpos'] == 'left' ) {
- $button .= '{icons:{primary:"ui-icon-' . $icon . '"}}';
+ $args[] = 'icons:{primary:"ui-icon-' . $icon . '"}';
} else {
- $button .= '{icons:{secondary:"ui-icon-' . $icon . '"}}';
+ $args[] = 'icons:{secondary:"ui-icon-' . $icon . '"}';
}
}
+ if (empty($title)) {
+ $args[] = 'text:false';
+ }
+
+ if (!empty($args)) {
+ $button .= '{' . implode(',', $args) . '}';
+ }
+
$button .= ').addClass("ui-priority-' . $priority . '");</script>';
$button_counter++;

0 comments on commit 3468522

Please sign in to comment.