function _invoice_get_icon in Invoice 7
Same name and namespace in other branches
- 6 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 - Implements hook_view()
- _invoice_get_invoice_items in ./
invoice_form.inc - Form helper function to get all invoice items
File
- ./
invoice_helpers.inc, line 606 - Invoice module
Code
function _invoice_get_icon($name, $url = NULL, $attributes = array(), $extension = 'png') {
$attributes['alt'] = isset($attributes['alt']) ? $attributes['alt'] : '';
if (empty($attributes['alt']) && isset($attributes['title']) && !empty($attributes['title'])) {
$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,
));
}
return $icon;
}