You are here

function mobile_codes_process_data in Mobile Codes 7.2

Same name and namespace in other branches
  1. 6.2 mobile_codes.module \mobile_codes_process_data()

Process the data provided to a Mobile Code.

Parameters

$data: The data provided to a Mobile Code.

1 call to mobile_codes_process_data()
mobile_codes_process_url in ./mobile_codes.module
Process Mobile Codes request URL.

File

./mobile_codes.module, line 258
Mobile Codes core functions.

Code

function mobile_codes_process_data(&$data) {
  $settings = array();
  $type = mobile_code_data_type($data);
  $defaults = mobile_codes_defaults();
  drupal_alter('mobile_codes_settings', $settings);
  if (isset($settings[$type]) && count($settings[$type]) > 0) {
    foreach ($settings[$type] as $setting => $values) {
      if (!empty($defaults[$type][$setting])) {
        $weight = isset($values['weight']) ? $values['weight'] : 0;
        $order[$weight] = isset($order[$weight]) ? $order[$weight] : array();
        $order[$weight][] = $setting;
      }
    }
    if (isset($order)) {
      ksort($order);
      foreach ($order as $settings) {
        sort($settings);
        foreach ($settings as $setting) {
          if (function_exists($function = "mobile_codes_data_{$type}_{$setting}")) {
            $function($data);
          }
        }
      }
    }
  }
}