You are here

function om_system_mediaqueries in OM Tools 7.2

Same name and namespace in other branches
  1. 8.2 tools/system/system.inc \om_system_mediaqueries()
  2. 6.2 tools/system/system.inc \om_system_mediaqueries()

Mediaqueries

1 call to om_system_mediaqueries()
om_system_tools in tools/system/system.inc
System Tools Form

File

tools/system/system.inc, line 114
System Tools

Code

function om_system_mediaqueries($system_defaults = array()) {

  // System Mediaqueries
  $out = array();
  $maxsizes = '1600, 1440, 1280, 1120, 960, 800, 640, 480';
  $theme_path = path_to_theme();

  // restores default values on initial install or no block classes variables
  if (!isset($system_defaults['system_mediaqueries_maxsizes']) && !isset($system_defaults['system_mediaqueries_path'])) {
    $system_defaults['system_mediaqueries_maxsizes'] = $maxsizes;
    $system_defaults['system_mediaqueries_path'] = $theme_path;
  }

  // Reset Node Form
  if (isset($system_defaults['system_mediaqueries_reset']) && $system_defaults['system_mediaqueries_reset'] == 1) {
    $system_defaults['system_mediaqueries_reset'] = 0;
    $system_defaults['system_mediaqueries_maxsizes'] = $maxsizes;
    $system_defaults['system_mediaqueries_path'] = $theme_path;
  }
  $out['system_mediaqueries_switch'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable Media Queries'),
    '#default_value' => isset($system_defaults['system_mediaqueries_switch']) ? $system_defaults['system_mediaqueries_switch'] : 0,
  );
  $out['system_mediaqueries_settings'] = array(
    '#type' => 'fieldset',
    '#attributes' => array(
      'id' => 'om-group-system-mediaqueries-settings',
    ),
    '#title' => t('Media Queries Stylesheet Settings for desktop, tablet, mobile devices.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $out['system_mediaqueries_settings']['system_mediaqueries_maxsizes'] = array(
    '#type' => 'textarea',
    '#default_value' => isset($system_defaults['system_mediaqueries_maxsizes']) ? $system_defaults['system_mediaqueries_maxsizes'] : '',
    '#rows' => 3,
    '#description' => t('Add basic or detailed media separated by comma<br />
      <strong>Basic Media:</strong> maximum width only<br />
      Ex. 1600, 1440, 1280, 1120, 960, 800, 640, 480<br />
      <strong>Detailed Media:</strong> type1 | minimum width | maximum width | type2 | type3 | type4<br />
      Ex. screen|320|480|handheld, projector|800|1400, print||800<br />
      <em>Note: To unset minimum or maximum width just leave it blank, ex. print||800</em>
    '),
  );
  $out['system_mediaqueries_settings']['system_mediaqueries_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Stylesheets path'),
    '#default_value' => isset($system_defaults['system_mediaqueries_path']) ? $system_defaults['system_mediaqueries_path'] : '',
    '#width' => 30,
    '#description' => t('Where do your media stylesheets located? ex. sites/default/themes/mytheme/css'),
  );
  $out['system_mediaqueries_reset'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reset to default values.'),
    '#default_value' => isset($system_defaults['system_mediaqueries_reset']) ? $system_defaults['system_mediaqueries_reset'] : 0,
  );
  return $out;
}