Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

function tep_draw_bootstrap_button


Recommended Posts

This function is called in a number of contributions and I cannot find the function itself anywhere.

Can anyone tell me where the source is for this function, I only have tep_draw_button which is not bootstrap.

Link to comment
Share on other sites

Copy the following into the admin/includes/functions/html_output.php file at the bottom before the ?>.

 function tep_draw_bootstrap_button($title = null, $icon = null, $link = null, $priority = 'secondary', $params = [], $style = null) {
    if ( !isset($params['type']) || !in_array($params['type'], ['submit', 'button', 'reset']) ) {
      $params['type'] = 'submit';
    }

    if ( ($params['type'] == 'submit') && isset($link) ) {
      $params['type'] = 'button';
    }

    if ( ($params['type'] == 'button') && isset($link) ) {
      $button = '<a href="' . $link . '"';

      if ( isset($params['newwindow']) ) {
        $button .= ' target="_blank" rel="noopener"';
      }
      $closing_tag = '</a>';
    } else {
      $button = '<button type="' . tep_output_string($params['type']) . '"';
      $closing_tag = '</button>';
    }

    if ( isset($params['params']) ) {
      $button .= ' ' . $params['params'];
    }

    $button .= ' class="btn ';
    $button .= (isset($style)) ? $style : 'btn-outline-secondary';
    $button .= '">';

    if (isset($icon) && tep_not_null($icon)) {
      $button .= ' <span class="' . $icon . '" aria-hidden="true"></span> ';
    }

    $button .= $title;
    $button .= $closing_tag;

    return $button;
  }

 

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...