예제 #1
0
 /**
  * return an instance of GlyphButton with a glyph defined by string or index
  * @param string|int $glyph
  * @return \Ajax\bootstrap\html\HtmlGlyphicon
  */
 public static function getGlyphicon($glyph)
 {
     $result = new HtmlGlyphicon("");
     if (is_int($glyph)) {
         $glyphs = CssGlyphicon::getConstants();
         if ($glyph < sizeof($glyphs)) {
             $glyph = array_values($glyphs)[$glyph];
         }
     }
     $result->setGlyphicon($glyph);
     return $result;
 }
 public function wrapContentWithGlyph($glyphBefore, $glyphAfter = "")
 {
     $before = HtmlGlyphicon::getGlyphicon($glyphBefore) . "&nbsp;";
     $after = "";
     if ($glyphAfter !== "") {
         $after = "&nbsp;" . HtmlGlyphicon::getGlyphicon($glyphAfter);
     }
     return $this->wrapContent($before, $after);
 }
 public function addGlyph($glyphicon, $left = true, $separator = "&nbsp;")
 {
     $glyph = new HtmlGlyphicon("glyph-" . $this->identifier);
     $glyph->setGlyphicon($glyphicon);
     if ($left) {
         $this->content = $glyph->compile() . $separator . $this->content;
     } else {
         $this->content .= $separator . $glyph->compile();
     }
     return $this;
 }