예제 #1
0
 /**
  * Recursively maps data to children
  *
  * @param mixed             $data
  * @param ElementCollection $children
  */
 protected function mapRequestDataToElementCollection($data, ElementCollection $children)
 {
     $children->forAll(function (ElementInterface $element) use($data) {
         $propertyPath = $this->getPropertyPathAsIndex($element);
         if (array_key_exists($element->getName(), $data)) {
             $values = $this->propertyAccessor->getValue($data, $propertyPath);
             $this->mapRequestDataToElement($values, $element);
         }
     });
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function addFilter(FilterInterface $filter)
 {
     $this->children->forAll(function (ElementInterface $element) use($filter) {
         $element->addFilter($filter);
     });
 }
예제 #3
0
 /**
  * Renders all children elements
  *
  * @param ElementCollection $children
  *
  * @return array
  */
 protected function renderChildren(ElementCollection $children)
 {
     $attributes = [];
     $children->forAll(function (ElementInterface $child) use(&$attributes) {
         $attributes[] = $this->renderElement($child);
     });
     return $attributes;
 }
예제 #4
0
 /**
  * Maps data using recursion to all children
  *
  * @param ElementCollection $children
  */
 protected function mapModelDataToElementCollection(ElementCollection $children)
 {
     foreach ($children->all() as $child) {
         $this->mapModelDataToElement($child);
     }
 }
 /**
  * Maps errors to elements children
  *
  * @param array             $messages
  * @param ElementCollection $children
  */
 protected function mapMessagesToElementCollection(array $messages, ElementCollection $children)
 {
     $children->forAll(function (ElementInterface $element) use($messages) {
         $this->mapMessagesToElement($messages, $element);
     });
 }