/** * 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; }
/** * {@inheritdoc} */ public function toString() { $this->end(); return parent::toString(); }
/** * Construct HTML node. * @param string $tag HTML tag. */ public function __construct($tag) { parent::__construct(); $this->tag = $tag; $this->selfClosing = Html::isSelfClosing($tag); }
/** * 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(); }