コード例 #1
0
ファイル: HTMLTest.php プロジェクト: lechimp-p/php-formlets
 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"));
 }
コード例 #2
0
ファイル: Formlet.php プロジェクト: lechimp-p/php-formlets
 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;
     }));
 }
コード例 #3
0
 public function buildWithDict(RenderDict $dict)
 {
     return H::concat($this->_l->buildWithDict($dict), $this->_r->buildWithDict($dict));
 }
コード例 #4
0
ファイル: HTML.php プロジェクト: lechimp-p/php-formlets
 /**
  * Get a new HTML by concatenating $this and $other.
  */
 public function cat(HTML $right)
 {
     return HTML::concat($this, $right);
 }