kartik\tree\TreeView::renderNodeIcon PHP Méthode

renderNodeIcon() protected méthode

Render the default node icon markup
protected renderNodeIcon ( string $icon, integer $iconType, boolean $child = true ) : string
$icon string the current node's icon
$iconType integer the current node's icon type, must be one of: - `TreeView::ICON_CSS` or `1`: if the icon css class suffix name is stored in $icon. - `TreeView::ICON_RAW` or `2`: if the raw icon markup is stored in $icon.
$child boolean whether child or parent
Résultat string
    protected function renderNodeIcon($icon, $iconType, $child = true)
    {
        if (!empty($icon)) {
            $options = $child ? $this->childNodeIconOptions : $this->parentNodeIconOptions;
            $css = $this->_iconPrefix . $icon;
            $icon = $iconType == self::ICON_CSS ? Html::tag('span', '', ['class' => $css]) : $icon;
            return Html::tag('span', $icon, $options);
        }
        $content = $this->defaultParentNodeIcon . $this->defaultParentNodeOpenIcon;
        return Html::tag('span', $content, $this->parentNodeIconOptions) . Html::tag('span', $this->defaultChildNodeIcon, $this->childNodeIconOptions);
    }