protected function getChildValues($filtered = false) { $value = parent::getChildValues($filtered); if (!$this->prependsName()) { return $value; } elseif (!strpos($this->getName(), '[')) { return isset($value[$this->getName()]) ? $value[$this->getName()] : null; } else { $tokens = explode('[', str_replace(']', '', $this->getName())); $valueAry =& $value; do { $token = array_shift($tokens); if (!isset($valueAry[$token])) { return null; } $valueAry =& $valueAry[$token]; } while ($tokens); return $valueAry; } }
/** * Returns the array containing child elements' values * * Iterates over all available repeat indexes to get values * * @param bool $filtered Whether child elements should apply filters on values * * @return array|null */ protected function getChildValues($filtered = false) { $backup = $this->backupChildAttributes(); $values = array(); foreach ($this->getIndexes() as $index) { $this->replaceIndexTemplates($index, $backup); if (null !== ($itemValues = parent::getChildValues($filtered))) { $values = self::arrayMerge($values, $itemValues); } } $this->restoreChildAttributes($backup); return empty($values) ? null : $values; }