A
A
Alexander Stepanov2019-02-17 03:38:40
Yii
Alexander Stepanov, 2019-02-17 03:38:40

How to change variable from dmstr/AdminLTE extension?

I noticed that in the dmstr / AdminLTE menu it substitutes its classes, not classes, and this interferes with the constantly updated FontAwesome a little - some icons do not want to be displayed in any way.
I found a variable in the code that substitutes this prefix and I want to change it to "empty-empty". You can, of course, correct this in the dmstr / AdminLTE code itself, but this change will fail when dmstr / AdminLTE is updated ... Tell me
, how can I override this variable in the view?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2019-02-18
@Exebeche

If you need more than once, then the advice above, if you need it globally, then I use a container through DI and change the settings globally for any class. For example, like this:

namespace app;

class Bootstrap implements \yii\base\BootstrapInterface
{

    /**
     * Bootstrap method to be called during application bootstrap stage.
     *
     * @param \yii\base\Application $app the application currently running
     */
    public function bootstrap($app)
    {
        $this->gridViewSetting();
    }

    /**
     * Применение настроек для yii\grid\GridView и yii\widgets\DetailView
     */
    protected function gridViewSetting()
    {
        $gridSetting = [
            'tableOptions' => ['class' => 'table table-condensed'],
            'options' => ['class' => 'table-responsive'],
            'summary' => false
        ];
        \Yii::$container->set('yii\grid\GridView', $gridSetting);

        $viewSetting = [
            'options' => ['class' => 'table'],
        ];
        \Yii::$container->set('yii\widgets\DetailView', $viewSetting);


    }
}

I made a separate Bootstrap loading class and included it in the config. Further in it I replace the necessary parameters globally. In your case it will be like this:
<?php

namespace app;

class Bootstrap implements \yii\base\BootstrapInterface
{

    /**
     * Bootstrap method to be called during application bootstrap stage.
     *
     * @param \yii\base\Application $app the application currently running
     */
    public function bootstrap($app)
    {
        $MenuSetting = [
            'iconClassPrefix' => '',
        ];
        \Yii::$container->set('dmstr\widgets\Menu', $MenuSetting);
    }

}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question