You are here

public function FieldHierarchy::options in Corresponding Entity References 7.3

File

field_object/includes/FieldHierarchy.inc, line 22
Contains the FieldHierarchy class.

Class

FieldHierarchy
@file Contains the FieldHierarchy class.

Code

public function options($key = FieldHierarchy::ROOT, $parent = NULL, $depth = -1) {
  $options = array();
  $item = $this->data[$key];
  if (isset($item['label'])) {
    $options[$key] = str_repeat('-', $depth) . $item['label'];
  }
  if (isset($item['children'])) {
    foreach ($item['children'] as $child) {
      $options = array_merge($options, $this
        ->options($child, $key, $depth + 1));
    }
  }
  return $options;
}