A
A
Alexander Stepanov2018-03-20 03:08:19
Yii
Alexander Stepanov, 2018-03-20 03:08:19

How to add custom variables to yii2fullcalendar?

There is an excellent extension "philippfrenzel/yii2fullcalendar", but it has its own variables, but you need to make an event with a bunch of fields, and when you add your own fields, it swears that it does not know such ...
How to add your own fields to this extension? Well, not only this, because the procedure is identical for all extensions :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2018-03-20
@Exebeche

Redefine the class and those methods and properties that work with your properties
An example as I did a long time ago:

namespace backend\widgets;

class yii2fullcalendar extends \yii2fullcalendar\yii2fullcalendar
{
    // Property 'contentHeight' absent in yii2fullcalendar
    // because add public property, add default value 'auto' and define registerPlugin
    public $contentHeight = 'auto';

    protected function registerPlugin()
    {
        if(isset($this->contentHeight) && !isset($this->clientOptions['contentHeight']))
        {
            $this->clientOptions['contentHeight'] = $this->contentHeight;
        }

        parent::registerPlugin();
    }
}

* This property is already included in the box (there was no time to contribute and the author did it himself)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question