You are here

function _imagepicker_get_icon in Image Picker 7

Same name and namespace in other branches
  1. 6.2 imagepicker.functions.inc \_imagepicker_get_icon()

Function to get an icon Derived from invoice module

Parameters

string $name: Name of icon without extension.

string $url: URL to link the icon to.

array $attributes: Any optional HTML attributes.

string $extension: The file extension.

Return value

The icon string.

3 calls to _imagepicker_get_icon()
imagepicker_admin_groups_list in ./imagepicker.admin.inc
imagepicker_browse_admin_form in ./imagepicker.functions.inc
imagepicker_groups_list in ./imagepicker.group.inc

File

./imagepicker.functions.inc, line 2960
@author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function _imagepicker_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', 'imagepicker') . '/images/' . $name . '.' . $extension . '"' . $img_addition . ' />';
  if (!empty($url)) {
    $icon = l($icon, $url, array(
      'html' => TRUE,
    ));
  }
  return $icon;
}