function depth_first_searches() { $is_text = V::fn(function ($html) { return $html instanceof HTMLText; }); $get_text = V::fn(function ($html) { return $html->content(); }); return array(array(H::text("Hello World"), $is_text, $get_text, "Hello World"), array(H::nop(), $is_text, $get_text, null), array(H::tag("foo", array(), H::text("Hello World")), $is_text, $get_text, "Hello World"), array(H::tag("foo", array(), H::concat(H::text("Hello World"), H::text("Hello World"))), $is_text, $get_text, "Hello World"), array(H::tag("foo", array(), H::concat(H::tag("bar", array(), H::concat(H::text("Hello World"), H::text("Blub"))), H::text("Blaw"))), $is_text, $get_text, "Hello World")); }
public static function with_errors(Formlet $other) { return $other->mapHTML(V::fn(function ($dict, $html) { $name = self::html_get_depth_first_name($html); if ($name === null) { throw new Exception("_with_errors applied to un-named Formlet."); } $errors = $dict->errors($name); if ($errors === null) { return $html; } foreach ($errors as $error) { $html = H::concat($html, H::tag("span", array("class" => "error"), H::text($error))); } return $html; })); }
public function buildWithDict(RenderDict $dict) { return H::concat($this->_l->buildWithDict($dict), $this->_r->buildWithDict($dict)); }
/** * Get a new HTML by concatenating $this and $other. */ public function cat(HTML $right) { return HTML::concat($this, $right); }