Ejemplo n.º 1
0
 /**
  * Create an HTML element.
  * @param string $tag Tag.
  * @param string[] $attributes Attributes, see {@see Html::readAttributes}.
  * @return Html Html node.
  */
 public function create($tag, $attributes = array())
 {
     $html = new Html($tag);
     $html->attr($attributes);
     return $html;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function toString()
 {
     $this->end();
     return parent::toString();
 }
Ejemplo n.º 3
0
 /**
  * Construct HTML node.
  * @param string $tag HTML tag.
  */
 public function __construct($tag)
 {
     parent::__construct();
     $this->tag = $tag;
     $this->selfClosing = Html::isSelfClosing($tag);
 }
Ejemplo n.º 4
0
 /**
  * Create an input element.
  * @param string $type Type.
  * @param string $field Field name.
  * @param string|string[] $attributes Attributes, see
  * {@see Html::readAttributes}.
  * @return string HTML element.
  */
 private function inputElement($type, $field, $attributes)
 {
     $attributes = Html::mergeAttributes(array('type' => $type, 'name' => $this->name($field), 'id' => $this->id($field), 'value' => $type != 'password' ? $this->value($field) : null, 'data-error' => $this->error($field, null)), $attributes);
     return $this->Html->create('input', $attributes)->toString();
 }