You are here

function smart_ip_views_bridge_form_alter in Smart IP 7.2

Same name and namespace in other branches
  1. 6.2 modules/smart_ip_views_bridge/smart_ip_views_bridge.module \smart_ip_views_bridge_form_alter()
  2. 6 modules/smart_ip_views_bridge/smart_ip_views_bridge.module \smart_ip_views_bridge_form_alter()

Implements hook_form_alter().

File

modules/smart_ip_views_bridge/smart_ip_views_bridge.module, line 81
Non-displayable characters.

Code

function smart_ip_views_bridge_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'views_ui_config_item_form' && $form_state['section'] == 'filters') {
    if (array_key_exists('=', $form['options']['operator']['#options']) || array_key_exists('is', $form['options']['operator']['#options']) || array_key_exists('in', $form['options']['operator']['#options']) || array_key_exists('or', $form['options']['operator']['#options'])) {
      if ($form['options']['value']['#type'] == 'textfield') {
        $form['options']['value']['#description'] = '<p><strong>' . t('Smart IP tokens:') . '</strong><br />' . 'smart_ip][location][country<br />' . 'smart_ip][location][country_code<br />' . 'smart_ip][location][region<br />' . 'smart_ip][location][region_code<br />' . 'smart_ip][location][city<br />' . 'smart_ip][location][zip';
      }
      if ($form['options']['value']['#type'] == 'select' || $form['options']['value']['#type'] == 'checkboxes') {
        $smart_ip_options = smart_ip_views_bridge_form_select_field_tokens();
        $form['options']['value']['#options'] = array_merge($form['options']['value']['#options'], $smart_ip_options);
      }
    }
  }
}