Beispiel #1
0
 /**
  * Handles special variable names
  *
  * @param string $key   Current part of the complete variable name
  * @param mixed  $value The value
  *
  * @return void
  */
 private function filterSpecialNames(&$key, &$value)
 {
     if ($key === 'node' && is_array($value)) {
         $key = 'nodes';
         $value = array($value);
     }
     if ($key === 'nodes') {
         $nodes = array();
         foreach ($value as $id => $options) {
             if ($options instanceof Node) {
                 $node = $options;
             } else {
                 $node = new Node($this);
                 $node->setFromArray($options);
             }
             $node->set('id', $id);
             $nodes[$id] = $node;
         }
         $value = $nodes;
     }
 }