Extending Activefield

Hi guys.

Current ActiveField implementation relies on TBS heavily, and sometimes it’s not very convenient.

Suppose I want to use it for my custom html markup.

I can do some customization overriding options, template, inputOptions and errorOptions of ActiveField app-wide using


\Yii::$container->set('yii\widgets\ActiveField', ...)

But suppose I need to customize checkbox html.

Since ActiveField uses Html::activeCheckbox, the only way that comes to my mind is overriding the whole Html class using classmap.

That is, I can do this:


\Yii::$classMap['yii\helpers\Html' = '@app/helpers/Html.php';

Everythind works fine except my IDE is complaining about two "yii\helpers\HTML" classes.

So here are the questions:

  1. Is there a way to do this in a simpler way?

  2. How can I get rid of IDE warning?

Wouldn’t extending ActiveField be simpler (as you mention in your title)?

Probably not, because it has Html::something all over the place, and some of these methods must be changed for my markup.