Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving SmallBox widget: Adding Footer Icon Option #4

Open
huhufajri opened this issue Feb 19, 2023 · 0 comments
Open

Improving SmallBox widget: Adding Footer Icon Option #4

huhufajri opened this issue Feb 19, 2023 · 0 comments

Comments

@huhufajri
Copy link

Regarding the provided code, it seems that setting the 'linkText' attribute to false in the SmallBox widget will remove the hyperlink but keep the icon.

  <?= \hail812\adminlte\widgets\SmallBox::widget([
                'title' =>'150',
                'text' => 'School',
                'icon' => 'fas fa-building',
                'linkText' => false,
                'theme' => 'primary'
                
            ]) ?>

It would be better to modify the 'renderFooter' method in the widget's code to include an option to display a footer icon.

protected function renderFooter()
    {
        $i= '';
        if ($this->linkText !== false) {
            empty($this->linkText) && $this->linkText = 'More info';
            $i = Html::tag('i', '', ['class' => 'fas fa-arrow-circle-right']);
            
        }
        $a = Html::a($this->linkText.' '.$i, $this->linkUrl, $this->linkOptions);

        return $a;
    }

Alternatively, a new property could be added to the widget called 'footericon'.

public footerIcon = Html::tag('i', '', ['class' => 'fas fa-arrow-circle-right']);

protected function renderFooter()
    {
       
        if ($this->linkText !== false) {
            empty($this->linkText) && $this->linkText = 'More info'; 
        }
        if($this->footerIcon == false {
         $this->footerIcon = '';
        }

        $a = Html::a($this->linkText.' '. $this->footerIcon, $this->linkUrl, $this->linkOptions);

        return $a;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant