1 system.api.php hook_icon_info_alter(&$icons)

Modify the list of icons provided by other modules.

Note that core-provided icons are not in this list. If wanting to override core-provided icons, use hook_icon_info(). This hook is only useful if wanting to modify the icons provided by another module.

@since 1.28.0 Hook added.

Parameters

$icons: This parameter is passed by reference. It contains the entire list of module-provided icons, keyed by the icon name.

See also

hook_icon_info()

Related topics

File

core/modules/system/system.api.php, line 519
Hooks provided by Backdrop core and the System module.

Code

function hook_icon_info_alter(&$icons) {
  // Remove a different module's override of a core icon.
  if (isset($icons['pencil']) && $icons['pencil']['module'] === 'different_module') {
    unset($icons['pencil']);
  }

  // Swap a different module's icon for one provide by this module.
  if (isset($icons['pencil'])) {
    $icons['pencil']['module'] = 'my_module';
    $icons['pencil']['directory'] = backdrop_get_path('module', 'my_module') . '/icons';
  }
}