Esempio n. 1
0
 public function render(Entity $entity)
 {
     $value = $entity->getValue();
     $attr = $this->attributes + array('type' => $this->type, 'id' => $entity->getId(), 'name' => $entity->getFullName());
     if ($entity->isArray()) {
         $output = "";
         foreach ($value as $v) {
             // TODO: does not preserve keys, is this ok?
             $output .= Entity::html('input', $attr + array('value' => $v));
         }
         return $output;
     }
     return Entity::html('input', $attr + array('value' => $value));
 }
Esempio n. 2
0
 public function render(Entity $entity)
 {
     $attr = $this->attributes + array('type' => $this->type, 'id' => $entity->getId(), 'required' => $entity->getRequired(), 'name' => $entity->getFullName(), 'multiple' => $entity->isArray());
     return Entity::html('input', $attr);
 }