You are here

function magic_dev_magic in Magic 7

Implements hook_magic().

File

magic_dev/magic_dev.module, line 11
Development settings for the magic module.

Code

function magic_dev_magic($magic_settings, $theme) {
  $settings = array();

  // Development Magic Grouping
  $settings['dev'] = array(
    '#type' => 'fieldset',
    '#title' => t('Development Enhancements'),
  );

  // Footer JavaScript Option
  $settings['dev']['magic_rebuild_registry'] = array(
    '#type' => 'checkbox',
    '#title' => t('Rebuild Theme Registry on Reload'),
    '#description' => t('<a href="!link" target="_blank">Rebuild the theme registry</a> during project development.', array(
      '!link' => 'http://drupal.org/node/173880#theme-registry',
    )),
    '#default_value' => theme_get_setting('magic_rebuild_registry', $theme),
  );

  // Viewport Indicator Option
  $settings['dev']['magic_viewport_indicator'] = array(
    '#type' => 'checkbox',
    '#title' => t('Viewport Width Indicator'),
    '#description' => t('Displays an indicator of the viewport. Tap/click to toggle between <em>em</em> and <em>px</em>. The CSS and JavaScript for this will bypass your CSS and JavaScript exclude options.'),
    '#default_value' => theme_get_setting('magic_viewport_indicator', $theme),
  );
  if (module_exists('modernizr')) {

    // Modernizr Debug Option
    $options = array(
      'attributes' => array(
        'target' => '_blank',
      ),
    );
    $settings['dev']['magic_modernizr_debug'] = array(
      '#type' => 'checkbox',
      '#title' => t('Modernizr Indicator'),
      '#description' => t('Displays an indicator of !modernizr detected features. Tap/click to toggle display of all of the available features. Install the !module for full Modernizr support. The CSS and JavaScript for this will bypass your CSS and JavaScript exclude options.', array(
        '!modernizr' => l('Modernizr', 'http://modernizr.com/', $options),
        '!module' => l('Modernizr Drupal module', 'http://drupal.org/project/modernizr', $options),
      )),
      '#default_value' => theme_get_setting('magic_modernizr_debug', $theme),
    );
  }
  else {

    // We don't have modernizr :-(
    $settings['dev']['magic_modernizr_debug'] = array(
      '#type' => 'hidden',
      '#value' => FALSE,
    );
  }
  return $settings;
}