S
S
Sergey Beloventsev2017-03-02 14:11:28
Yii
Sergey Beloventsev, 2017-03-02 14:11:28

What's wrong with seeing?

trying to create my first behavior
actually here

use backend\modules\menus\behavior\MenuFrontendBehavior;
    
    class Firmcat extends \yii\db\ActiveRecord
    {
        public function behaviors()
        {
            return [
                [
                    [
                        'class' => SluggableBehavior::className(),
                        'attribute' => 'title',
                        'slugAttribute' => 'slug'
                    ],
                    'MenuFrontendBehavior' => [
                        'class' => MenuFrontendBehavior::className(),
                    ]
                 ]
            ];
        }

this is how I try to get it in the module controller
class Firmcat extends \yii\db\ActiveRecord
    {
        public function behaviors()
        {
            return [
                [
                    [
                        'class' => SluggableBehavior::className(),
                        'attribute' => 'title',
                        'slugAttribute' => 'slug'
                    ],
                    'MenuFrontendBehaviors' => [
                        'class' => MenuFrontendBehavior::className(),
                        //'model' => 'yes',
                        //'prop2' => 'value2',* /
                    ]
                 ]
            ];
        }

I get such an error
Invalid Configuration – yii\base\InvalidConfigException
Object configuration must be an array containing a "class" element.

Please explain what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
E
Evgeny Bukharev, 2017-03-02
@Sergalas

Offhand, I can assume that you have too many arrays in nesting

return [
                [
                 .....
                ]
]

necessary
return [
                 .....
]

I
Ivan Koryukov, 2017-11-21
@MadridianFox

Universal - no way. Of course, you can try to rely on the nav and main tags, but no one guarantees that they are used, no one guarantees that they have what you need.

P
Pavel Kornilov, 2017-11-21
@KorniloFF

No way.
Well, the menu block can still be somehow determined by the links going in it in a row. And then, it must be borne in mind that links can have multi-level wrappers, as is done in the same Yukoz in default templates.
But it’s impossible to cleanly separate the content from the same sidebars, footers, ads and other things.

I
index0h, 2017-11-21
@index0h

It's easy, we hire a student with a small amount, we say what to do and voila

M
Maksim Fedorov, 2017-11-21
@Maksclub

Content Downloader X1 - universal content parser

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question