Widgets customizing and overriding of widgets

1 Overriding default widget templates

You can easily override widget views (=templates). This flexible solution was developed to allow clients to customize widget views for their needs.

To override widget views you need to find the original view in common folder and copy it to custom folder in the same directory structure.

For example, you need to override view /common/modules/comments/widgets/views/CommentsFormWidget.php

you need to copy it into

/custom/modules/comments/widgets/views/CommentsFormWidget.php

and change it there.

1.1 How disable widget’s views overriding

Overriding can be disabled in any time by specifying this option in the configuration:


'params' => array(
        //If true try to use view files from custom section
        'customViews' => false,
        ...................
        )

2 Overriding widget classes

You can override widget’s class definition also.

For example, you need to override widget’s class common/modules/comments/widgets/CommentsFormWidget.php

you need to copy it into

custom/modules/comments/widgets/CommentsFormWidget.php

and change it there.

2.1 How disable widget’s class overriding

Overriding can be disabled in any time by setting this option as false in the configuration:


'params' => array(
        //If parameter is true portal tries to find called widget classes in custom section
        'customWidgets' => true,
        ...................
        )