src/View/Helper/NavbarHelper.php
public function text($text, $options = []) {
        $options += [
            'templateVars' => []
        ];
        $text = preg_replace_callback('/<a([^>]*)?>([^<]*)?<\/a>/i', function($matches) {
            $attrs = preg_replace_callback ('/class="(.*)?"/', function ($m) {
                $cl = $this->addClass (['class' => $m[1]], 'navbar-link');
                return 'class="'.$cl['class'].'"';
            }, $matches[1], -1, $count);
            if ($count == 0) {
                $attrs .= ' class="navbar-link"';
            }
            return '<a'.$attrs.'>'.$matches[2].'</a>';
        }, $text);
        return $this->formatTemplate('navbarText', [
            'content' => $text,
            'attrs' => $this->templater()->formatAttributes($options),
            'templateVars' => $options['templateVars']
        ]);
    }
public function text($text, $options = []) {
        $options += [
            'templateVars' => []
        ];
        $text = preg_replace_callback('/<a([^>]*)?>([^<]*)?<\/a>/i', function($matches) {
            $attrs = preg_replace_callback ('/class="(.*)?"/', function ($m) {
                $cl = $this->addClass (['class' => $m[1]], 'navbar-link');
                return 'class="'.$cl['class'].'"';
            }, $matches[1], -1, $count);
            if ($count == 0) {
                $attrs .= ' class="navbar-link"';
            }
            return '<a'.$attrs.'>'.$matches[2].'</a>';
        }, $text);
        return $this->formatTemplate('navbarText', [
            'content' => $text,
            'attrs' => $this->templater()->formatAttributes($options),
            'templateVars' => $options['templateVars']
        ]);
    }
public function text ( $ text , $ options = [ ] ) { $ options += [ 'templateVars' => [ ] ] ; $ text = preg_replace_callback ( '/<a([^>]*)?>([^<]*)?<\/a>/i' , function ( $ matches ) { $ attrs = preg_replace_callback ( '/class="(.*)?"/' , function ( $ m ) { $ cl = $ this -> addClass ( [ 'class' => $ m [ 1 ] ] , 'navbar-link' ) ; return 'class="' . $ cl [ 'class' ] . '"' ; } , $ matches [ 1 ] , - 1 , $ count ) ; if ( $ count == 0 ) { $ attrs .= ' class="navbar-link"' ; } return '<a' . $ attrs . '>' . $ matches [ 2 ] . '</a>' ; } , $ text ) ; return $ this -> formatTemplate ( 'navbarText' , [ 'content' => $ text , 'attrs' => $ this -> templater ( ) -> formatAttributes ( $ options ) , 'templateVars' => $ options [ 'templateVars' ] ] ) ; }
Add a text to the navbar.

### Options

- `templateVars` Provide template variables for the text template.
- Other attributes will be assigned to the text element.

@param string $text The text message.
@param array $options Array attributes for the wrapper element.

@return string A HTML element wrapping the text for the navbar.
Add a text to the navbar .