cannot override static methods (Late Static Bindings)

Issue #19 wontfix
Николай Сахновский created an issue

Hi! I wont use this extention for admin theme (based on BS 3).

I need extends for example BSHtml and override some static methods, but it not have effect beacause you always use calls like:

$label = self::icon($icon) . ' ' . $label;

I think it will be useful if you make change to:

$label = static::icon($icon) . ' ' . $label;

Comments (4)

  1. Spyros Solda

    I have the same problem in BsActiveForm.

    For example I want to overide

    static private function setLabelOptionsByLayout($layout,$labelOptions=array())

    to make some changes to the labels but I can't.

    So I had to overide

    protected function processRowOptions($model, $attribute, $options) that calls setLabelOptionsByLayout , create an instance version of setLabelOptionsByLayout and call it by

    $this->setLayoutLabelOptions($labelOptions);

    In my opinion this static function could be written as

     protected function setLayoutLabelOptions($labelOptions=array()){
            $layout = $this->layout;
           .....
    }
    

    So we could overide it.

  2. Log in to comment