/**
  * Returns the data sources for this element
  *
  * @return   array
  */
 protected function getDataSources()
 {
     if (empty($this->container)) {
         return array();
     } else {
         return $this->container->getDataSources();
     }
 }
 /**
  * Called when the element needs to update its value from form's data sources
  *
  * Behaves similar to Element::updateValue(), the field's value is used to
  * deduce indexes taken by repeat items.
  *
  * @see setIndexField()
  * @throws HTML_QuickForm2_Exception
  */
 protected function updateValue()
 {
     // check that we are not added to another Repeat
     // done here instead of in setContainer() for reasons outlined in InputFile
     $container = $this->getContainer();
     while (!empty($container)) {
         if ($container instanceof self) {
             throw new HTML_QuickForm2_Exception("Repeat element cannot be added to another Repeat element");
         }
         $container = $container->getContainer();
     }
     if (null === $this->indexField && !$this->_guessIndexField()) {
         return;
     }
     /* @var HTML_QuickForm2_DataSource $ds */
     foreach (parent::getDataSources() as $ds) {
         if (null !== ($value = $ds->getValue($this->indexField))) {
             $this->setIndexes(array_keys($value));
             return;
         }
     }
 }