Ejemplo n.º 1
0
 public function render(Entity $entity)
 {
     $datalist = '';
     if (count($this->datalist)) {
         foreach ($this->datalist as $value) {
             $datalist .= Entity::html('option', array('value' => $value));
         }
         $datalist = Entity::html('datalist', array('id' => $entity->getId() . '-datalist'), $datalist);
     }
     $attr = $this->attributes + array('type' => $this->type, 'id' => $entity->getId(), 'required' => $entity->getRequired(), 'name' => $entity->getFullName(), 'value' => $this->getValue($entity), 'list' => $datalist ? $entity->getId() . '-datalist' : null);
     return $datalist . Entity::html('input', $attr);
 }
Ejemplo n.º 2
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));
 }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
0
 public function render(Entity $entity)
 {
     $values = (array) $entity->getValue();
     return $this->buildChoices($entity->getFullName(), $entity->getId(), $entity->getChoices(), $values, $entity->getDisabledChoices());
 }
Ejemplo n.º 5
0
 public function render(Entity $entity)
 {
     $attr = $this->attributes + array('id' => $entity->getId(), 'name' => $entity->getFullName(), 'required' => $entity->getRequired());
     return Entity::html('textarea', $attr, htmlspecialchars($entity->getValue()));
 }
Ejemplo n.º 6
0
 public function render(Entity $entity)
 {
     $attr = $this->attributes + array('id' => $entity->getId(), 'type' => $this->type, 'name' => $entity->getFullName());
     return Entity::html('button', $attr, htmlspecialchars($entity->getLabel()));
 }
Ejemplo n.º 7
0
 public function render(Entity $entity)
 {
     $attr = $this->attributes + array('id' => $entity->getId(), 'name' => $entity->getFullName());
     return Entity::html('select', $attr, $this->buildChoices($this->getChoices(), (array) $entity->getValue(), $this->getDisabledChoices()));
 }
Ejemplo n.º 8
0
 public function renderNormal(Entity $entity)
 {
     $attr = array('id' => $entity->getId() . '-label', 'class' => $entity->getWrapperClass());
     return Entity::html('dt', $attr, $entity->isLabelOutside() ? $entity->renderLabel() : '') . Entity::html('dd', array('id' => $entity->getId() . '-element'), $entity->render() . $entity->renderDescription() . $entity->renderErrors());
 }