Caffeinated\Menus\Item::icon PHP Method

icon() public method

Appends the specified icon to the item.
public icon ( string $icon, string $type = 'fontawesome' ) : Item
$icon string
$type string Can be either "fontawesome" or "glyphicon"
return Item
    public function icon($icon, $type = 'fontawesome')
    {
        switch ($type) {
            case 'fontawesome':
                $html = '<i class="fa fa-' . $icon . ' fa-fw"></i>';
                break;
            case 'glyphicon':
                $html = '<span class="glyphicon glyphicon-' . $icon . '" aria-hidden="true"></span>';
                break;
            case 'entypo':
                $html = '<i class="entypo-' . $icon . '"></i>';
                break;
            default:
                $html = '<i class="' . $icon . '"></i>';
                break;
        }
        return $this->data('icon', $html);
    }