You are here

function _invoice_get_icon in Invoice 6

Same name and namespace in other branches
  1. 7 invoice_helpers.inc \_invoice_get_icon()

Helper function to get an icon

4 calls to _invoice_get_icon()
invoice_invoices in ./invoice.module
Overview of all invoices
invoice_save_item in ./invoice_ajax.inc
Add an invoice item
invoice_view in ./invoice.module
Implementation of hook_view()
_invoice_get_invoice_items in ./invoice_form.inc
Form helper function to get all invoice items

File

./invoice_helpers.inc, line 496
Invoice module

Code

function _invoice_get_icon($name, $url = NULL, $attributes = array(), $extension = 'png') {
  if (empty($attributes['alt'])) {
    $attributes['alt'] = $attributes['title'];
  }
  $img_addition = '';
  foreach ($attributes as $key => $value) {
    $img_addition .= ' ' . $key . '="' . $value . '"';
  }
  $icon = '<img src="' . base_path() . drupal_get_path('module', 'invoice') . '/images/' . $name . '.' . $extension . '"' . $img_addition . ' />';
  if (!empty($url)) {
    $icon = l($icon, $url, array(
      'html' => TRUE,
    ));

    //$icon = '<a href="'. base_path() . $url .'" '. drupal_attributes($attributes) .'>'. $icon .'</a>';
  }
  return $icon;
}