Exemplo n.º 1
0
 public function getIds()
 {
     $value = $this->getValue();
     $ids = array();
     if (\Admin\Core\Helper::isIteratable($value)) {
         foreach ($value as $object) {
             $ids[] = $this->parentProperty->adapter->getId($object);
         }
     } else {
         if (is_object($value)) {
             $ids[] = $this->parentProperty->adapter->getId($value);
         }
     }
     return $ids;
 }
Exemplo n.º 2
0
 public function getChildren()
 {
     if ($this->inline && empty($this->children)) {
         $values = $this->getValue();
         $beings = array();
         $amountOfInlines = 0;
         $realAction = \Admin\Core\API::get("action");
         \Admin\Core\API::set("action", "inline");
         if (\Admin\Core\Helper::isIteratable($values)) {
             foreach ($values as $value) {
                 if (is_object($value)) {
                     $id = $this->adapter->getId($value);
                     $being = $this->createBeing($this->being, $id);
                     $beings[] = $being;
                 }
                 $this->counter++;
             }
         } elseif (!empty($values) && is_object($values)) {
             $id = $this->adapter->getId($values);
             $being = $this->createBeing($this->being, $id);
             $beings[] = $being;
             $this->counter++;
         } else {
             $amountOfInlines = 1;
         }
         if ($this->mode == self::INLINE_MULTIPLE_MODE) {
             $amountOfInlines = 1;
         }
         for ($index = 0; $index < $amountOfInlines; $index++) {
             $being = $this->createBeing($this->being);
             if ($this->mode == self::INLINE_MULTIPLE_MODE) {
                 $being->unusedClass = "inline-unused";
             }
             $beings[] = $being;
             $this->counter++;
         }
         foreach ($beings as $key => $being) {
             $beings[$key]->parentProperty = $this;
         }
         \Admin\Core\API::set("action", $realAction);
         $this->children = $beings;
     }
     return $this->children;
 }