I’m trying to extend ActiveField to add a custom part to the template and have it then replaced with actual html output. I tried to code below, but the end result just shows {icon} instead of having it replaced using activeIcon. How do I go from here?
public function render($content = null) {
$this->parts['{icon}'] = static::activeIcon();
return parent::render();
}
public static function activeIcon() {
return 'Some HTML output';
}
It’s probably something very obvious, but I’ve been staring at it too long I guess.
Hi, I just tested your code and it works. Check your form view file, maybe the problem is in how you are trying to render your ActiveField. It should be something like: