Closed oscarnevarezleal closed 6 years ago
Did you try to add it in the init()
method of your component ?
try
public $user;
public function init()
{
$this->user = $this->user();
$this->attachUploader();
}
public function onRun()
{
$this->page['user_profile'] = $this->user;
}
public function addUploader()
{
if ($this->user) {
$this->imageUploader = $this->addComponent(
'NetSTI\Uploader\Components\ImageUploader',
'imageUploader',
['modelClass' => 'RainLab\User\Models\User', 'modelKeyColumn' => 'avatar', 'deferredBinding' => true]
);
$this->imageUploader->bindModel('avatar', $this->user );
}
}
Hi @rajakhoury that make the trick. Thanks 👍
Uploaders Scripts are not added unless I manually call OnRun from a component reference. Is this the right thing to do or I´m missing something.