You are here

function mobile_detect_ctools_access_settings in Mobile Detect 7

Settings form callback.

1 string reference to 'mobile_detect_ctools_access_settings'
mobile_detect_ctools.inc in mobile_detect_ctools/plugins/access/mobile_detect_ctools.inc

File

mobile_detect_ctools/plugins/access/mobile_detect_ctools.inc, line 23

Code

function mobile_detect_ctools_access_settings($form, &$form_state, $conf) {
  $form['settings']['type'] = array(
    '#title' => t('Mobile Device Type'),
    '#type' => 'radios',
    '#options' => array(
      'isMobile' => t('Mobile'),
      'isTablet' => t('Tablet'),
      'isHandheld' => t('Handheld'),
    ),
    '#description' => t('Mobile device type.'),
    '#default_value' => $conf['type'],
  );
  $detect = mobile_detect_get_object();
  foreach ($detect
    ->getRules() as $name => $regex) {
    $form['settings']['type']['#options']['is' . $name] = t('@name', array(
      '@name' => $name,
    ));
  }
  return $form;
}