예제 #1
0
function get_public_flag_label($public_flag, $view_icon_only = false, $return_type = 'array', $is_hidden_xs = false)
{
    if (!in_array($return_type, array('array', 'icon_term', 'label'))) {
        throw new InvalidArgumentException('Second parameter is invalid.');
    }
    $public_flag_key = 'public_flag.options.' . $public_flag;
    $icon = icon_label($public_flag_key, 'icon', $is_hidden_xs, null, 'fa fa-', 'i');
    $name = $view_icon_only ? '' : icon_label($public_flag_key, 'label', $is_hidden_xs, null, 'fa fa-', 'i');
    if ($return_type == 'icon_term') {
        return $icon . $name;
    }
    $color = Site_Util::get_public_flag_coloer_type($public_flag);
    if ($return_type == 'label') {
        return html_tag('span', array('class' => 'label label-' . $color), $icon . $name);
    }
    return array($name, $icon, 'btn-' . $color);
}