You are here

function theme_context_devel_recurse in Context 6

Same name and namespace in other branches
  1. 5 context_ui/context_ui.module \theme_context_devel_recurse()
  2. 6.2 context_ui/context_ui.module \theme_context_devel_recurse()

Helper function to theme_context_devel that recurses down context arrays and themes accordingly.

1 call to theme_context_devel_recurse()
theme_context_devel in context_ui/context_ui.module
Takes a retrieved context array and returns a themed out tree representation of that context.

File

context_ui/context_ui.module, line 268

Code

function theme_context_devel_recurse($value) {
  $output = '';
  if (is_array($value) || is_object($value)) {
    if (is_array($value)) {
      $type = 'array';
    }
    else {
      if (is_object($value)) {
        $type = 'object';
      }
    }
    foreach ((array) $value as $key => $a) {
      $output .= "<div class='context-devel-wrapper'><label><small>{$type}</small>{$key}</label>" . theme('context_devel_recurse', $a) . "</div>";
    }
  }
  else {
    if (is_string($value)) {
      $type = 'string';
    }
    else {
      if (is_int($value)) {
        $type = 'int';
      }
      else {
        if (is_bool($value)) {
          $type = 'bool';
        }
      }
    }
    $output .= "<div class='context-devel-wrapper'><label><small>{$type}</small>{$value}</label></div>";
  }
  return $output;
}