getCustomCssClass is not a yii\base\Widget or CardWidget method?
optmsp opened this issue · comments
I'm trying to test out your extension (thanks for the hard work by the way), but unable to proceed.
Your widgets are all calling $this->getCustomCssClass(), but that's not a method I'm seeing in yii\base\Widget and I don't see where you have defined it either?
I'm using current yii2.
Oh, that's interesting. I see you have it defined here: CustomCssSupportTrait and are using that as a trait. Yet, it's definitely giving me an error:
Calling unknown method: co0lc0der\Lte3Widgets\CardWidget::getCustomCssClass()
To test, I created a private method in CardWidget getCustomCssClass() and then things worked..
the file co0lc0der\yii2-adminlte3-widgets\src\CustomCssSupportTrait.php has a type in the function name
protected function getCustonCssClass(int $index): string
{
return (isset($this->cssClasses[$index]) && !empty($this->cssClasses[$index])) ? " {$this->cssClasses[$index]}" : '';
}
it just need to be changed to
protected function getCustomCssClass(int $index): string
{
return (isset($this->cssClasses[$index]) && !empty($this->cssClasses[$index])) ? " {$this->cssClasses[$index]}" : '';
}
@optmsp Hello! Thanks for the issue :) It is my bad. I placed using traits block after all properties. So you can use co0lc0der\Lte3Widget\CustomCssSupportTrait
in your custom card class. Or just extend your class of co0lc0der\Lte3Widget\CardWidget
and CustomCssSupportTrait
will be used automatically :)
I cleaned up the code, updated up to v0.6.2. Probably the problem will be solved