XF 2.1 Widgets

Haydric

Active member
I have been working on a custom add-on for some time now, I decided to upgrade my test board to 2.1 and it broke my widgets as the '$contextParams['user']' is not working on this renderer. Can anyone help me?

PHP:
<?php

namespace rpx\roleplay\Widget;
use XF\Widget\AbstractWidget;

class MemberCharacter extends AbstractWidget
{
    public function render()
    {
        $user = $this->contextParams['user'];
        $cCharacters = $this->finder('rpx\roleplay:Character')->where('user_id', $user->user_id)->order('create_date', 'DESC')->fetch();
        $characters = $this->finder('rpx\roleplay:Character')->where('user_id', $user->user_id)->order('create_date', 'DESC')->fetch();
        $total = $cCharacters->count();

        $viewParams = [
            'characters' => $characters,
             'total' => $total,
         ];
        return $this->renderer('widget_member_character', $viewParams);
    }
}

Can someone explain to me why context params are not working with this widget?
 
Dump the context parameters to see what is actually set at that point and what is not:
\XF::dump($this->contextParams);
 
Top Bottom