You are here

function icomoon_icon_icomoon_import_process in Icomoon 7

Implements hook_icon_PROVIDER_import_process().

File

./icomoon.module, line 76
icomoon.module Integrates the Icomoon service as an icon provider for Icon API.

Code

function icomoon_icon_icomoon_import_process(&$bundle) {
  if ($json = icomoon_get_json($bundle['path'])) {
    if (!empty($json['preferences']['fontPref']['ie7'])) {
      drupal_set_message(t('Notice: IE7 support was detected in your bundle and has been temporarily disabled. Please read the description below for further instructions.'), 'warning', FALSE);
    }

    // @todo remove this override once core can handle browser conditions in
    // drupal_add_js().
    // @see https://drupal.org/node/865536
    $json['preferences']['fontPref']['ie7'] = FALSE;

    // Merge in settings from archive.
    $bundle['settings'] = icon_array_merge_recursive($bundle['settings'], $json['preferences']['fontPref']);
    if (!empty($json['icons'])) {
      foreach ($json['icons'] as $icon) {
        $bundle['icons'][$icon['properties']['name']] = $icon['properties']['name'];
      }

      // Add processing callback.
      $bundle['#attached']['icomoon_process_attached'] = array(
        array(
          $bundle['name'],
        ),
      );
    }
  }
}