1 icon.inc icon_get_info($icon_name = NULL)

Get info about a module-provided icons.

Note this will not return information about core icons or theme-provided icons.

@since 1.28.0 Function added.

Parameters

string|null $icon_name: An icon name, with no extension, such as "home" or "info". If omitted, all icon info will be returned.

Return value

array:

File

core/includes/icon.inc, line 245
Provides the Backdrop API for placing icons.

Code

function icon_get_info($icon_name = NULL) {
  $icon_info = &backdrop_static(__FUNCTION__);

  if (!isset($icon_info)) {
    $icon_info = array();
    foreach (module_implements('icon_info') as $module) {
      $module_icon_info = module_invoke($module, 'icon_info');
      // Populate the 'module' key for each returned item.
      foreach (array_keys($module_icon_info) as $module_icon_name) {
        $module_icon_info[$module_icon_name]['module'] = $module;
      }
      $icon_info = array_merge($icon_info, $module_icon_info);
    }
    backdrop_alter('icon_info', $icon_info);
  }
  if ($icon_name) {
    return isset($icon_info[$icon_name]) ? $icon_info[$icon_name] : NULL;
  }
  else {
    return $icon_info;
  }
}