macgyer\yii2materializecss\widgets\form\SwitchButton::renderLabel PHP Method

renderLabel() protected method

This method also renders the corresponding icons, if set.
protected renderLabel ( string $state ) : string
$state string the state to used. Use "off" or "on".
return string the rendered label.
    protected function renderLabel($state)
    {
        $icon = $this->renderIcon($state);
        $encodeProperty = "encode" . ucfirst($state) . "Text";
        $textProperty = "{$state}Text";
        $label = $this->{$encodeProperty} ? Html::encode($this->{$textProperty}) : $this->{$textProperty};
        $label .= $icon;
        $html = [];
        $html[] = Html::beginTag('span', ['class' => "{$state}Label"]);
        $html[] = $label;
        $html[] = Html::endTag('span');
        return implode("\n", $html);
    }