src/Common.php
public function icon($symbol, $prefix = 'glyphicon', $tag = 'i')
    {
        $base = $prefix;
        $classes = explode(' ', $symbol);
        $prefix = array($classes[0]); // ie. only prefix the first class
        $params = '';
        if ($space = strpos($tag, ' ')) {
            $params = ' '.trim(substr($tag, $space));
            $tag = substr($tag, 0, $space);
        }
        if ($base == 'glyphicon') {
            $tag = 'span';
        }

        return $this->addClass("<{$tag}{$params}></{$tag}>", array(
            $tag => $this->prefixClasses($base, $prefix, $classes),
        ));
    }
public function icon($symbol, $prefix = 'glyphicon', $tag = 'i')
    {
        $base = $prefix;
        $classes = explode(' ', $symbol);
        $prefix = array($classes[0]); // ie. only prefix the first class
        $params = '';
        if ($space = strpos($tag, ' ')) {
            $params = ' '.trim(substr($tag, $space));
            $tag = substr($tag, 0, $space);
        }
        if ($base == 'glyphicon') {
            $tag = 'span';
        }

        return $this->addClass("<{$tag}{$params}></{$tag}>", array(
            $tag => $this->prefixClasses($base, $prefix, $classes),
        ));
    }
public function icon ( $ symbol , $ prefix = 'glyphicon' , $ tag = 'i' ) { $ base = $ prefix ; $ classes = explode ( ' ' , $ symbol ) ; $ prefix = array ( $ classes [ 0 ] ) ; // ie. only prefix the first class $ params = '' ; if ( $ space = strpos ( $ tag , ' ' ) ) { $ params = ' ' . trim ( substr ( $ tag , $ space ) ) ; $ tag = substr ( $ tag , 0 , $ space ) ; } if ( $ base == 'glyphicon' ) { $ tag = 'span' ; } return $ this -> addClass ( "<{$tag}{$params}></{$tag}>" , array ( $ tag => $ this -> prefixClasses ( $ base , $ prefix , $ classes ) , ) ) ; }
Create an icon without the verbosity.

@param string $symbol The icon you would like to display without the base and icon class prefix.
@param string $prefix The base and icon class prefix. The default is a Bootstrap icon, but this can be used with any icon font by simply entering their prefix value here.
@param string $tag    The tag to use for displaying your font. Everyone uses the ``<i>`` tag, so that is the default. If ``$prefix == 'glyphicon'`` (the default for Bootstrap) then we will use a span element. Why? I don't know, but since v.2 that seems to be what they prefer to use now. If you want to style an icon further then you can do so here. eg. ``'i style="font-size:16px;"'``.

@return string

@example

```php
echo $bp->icon('asterisk');
```
Create an icon without the verbosity .