You are here

function icomoon_process_attached in Icomoon 7

Attach callback for an IcoMoon bundle.

File

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

Code

function icomoon_process_attached($bundle_name) {
  $bundle = icon_bundle_load($bundle_name);
  if (!$bundle) {
    return;
  }
  $css = array();
  $js = array();

  // Apply default settings, in case bundle lives in code.
  $bundle['settings'] += icomoon_default_settings();
  $css[$bundle['path'] . '/style.css'] = array(
    'basename' => 'icomoon.' . $bundle_name . '.style.css',
  );

  // IE7 support.
  if (!empty($bundle['settings']['ie7'])) {
    $css[$bundle['path'] . '/ie7/ie7.css'] = array(
      'basename' => 'icomoon.' . $bundle_name . '.ie7.css',
      'browsers' => array(
        'IE' => 'lt IE 8',
        '!IE' => FALSE,
      ),
    );
    $js[$bundle['path'] . '/ie7/ie7.js'] = array(
      'scope' => 'footer',
      'browsers' => array(
        'IE' => 'lt IE 8',
        '!IE' => FALSE,
      ),
    );
  }
  foreach ($css as $data => $options) {
    drupal_add_css($data, $options);
  }
  foreach ($js as $data => $options) {
    drupal_add_js($data, $options);
  }
}