You are here

function smart_ip_views_bridge_substitute_token_value 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_substitute_token_value()
  2. 6 modules/smart_ip_views_bridge/smart_ip_views_bridge.module \smart_ip_views_bridge_substitute_token_value()

Substitute token to Smart IP value

4 calls to smart_ip_views_bridge_substitute_token_value()
smart_ip_views_bridge_openlayers_proximity_handler_filter_circle::exposed_form in modules/smart_ip_views_bridge/views/smart_ip_views_bridge_openlayers_proximity_handler_filter_circle.inc
Render our chunk of the exposed filter form when selecting
smart_ip_views_bridge_openlayers_proximity_handler_filter_circle::op_process in modules/smart_ip_views_bridge/views/smart_ip_views_bridge_openlayers_proximity_handler_filter_circle.inc
Process operator.
smart_ip_views_bridge_openlayers_proximity_handler_filter_square::exposed_form in modules/smart_ip_views_bridge/views/smart_ip_views_bridge_openlayers_proximity_handler_filter_square.inc
Render our chunk of the exposed filter form when selecting
smart_ip_views_bridge_openlayers_proximity_handler_filter_square::op_process in modules/smart_ip_views_bridge/views/smart_ip_views_bridge_openlayers_proximity_handler_filter_square.inc
Process operator.

File

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

Code

function smart_ip_views_bridge_substitute_token_value(&$view_filter_item, $token) {
  $output = array();
  $mutlti_smart_ip_tokens = explode(', ', $token);
  foreach ($mutlti_smart_ip_tokens as $token) {
    $smart_ip_index = explode('][', $token);
    $smart_ip_index_count = count($smart_ip_index);
    if ($smart_ip_index_count == 1) {
      $smart_ip_index = explode('.', $token);
      $smart_ip_index_count = count($smart_ip_index);
    }
    $smart_ip_session = smart_ip_session_get($smart_ip_index[0]);
    if ($smart_ip_index_count == 3 && isset($smart_ip_session[$smart_ip_index[1]][$smart_ip_index[2]])) {
      $output[] = $smart_ip_session[$smart_ip_index[1]][$smart_ip_index[2]];
    }
  }
  if (!empty($output)) {
    $view_filter_item = implode(', ', $output);
  }
  return $view_filter_item;
}