1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Unmaintained Custom Widget System (CWS) Alpha 2

Allows to manage sidebar widgets just like notices

  1. guiltar

    guiltar Well-Known Member

    guiltar submitted a new resource:

    Custom Widget System (CWS) - Allows to manage sidebar widgets just like notices

    Read more about this resource...
    CyberAP, erich37, mcatze and 2 others like this.
  2. cclaerhout

    cclaerhout Well-Known Member

    Guiltar is back ;) I will test this next week.
    Digital Doctor and guiltar like this.
  3. CFodder

    CFodder Well-Known Member

    Installed, it appears to overwrite XFRocks Widget Framework, is this deliberate?

    Bit more of an explanation of what this does and a basic guide, esp with regards to callbacks etc would be helpful.

    Will say that just from the quick look I've had at this it looks very powerful and configurable and looking forward to seeing where this goes :).
  4. guiltar

    guiltar Well-Known Member

    I have not tested them together but at least admin route 'widgets' will be rewrited.
    There are not much widgets not, but it's enough for testing alpha.

    I will add the basic guide and explanation a bit later when api will be stable.
    Actually, this it works like notices. But:
    • Widget can belong to some add-on and can be exported/imported with it.
    • Widget has 'position'. For now I created Left and Right sidebars, but its extendable.
    • Widget has callback class and callback method.
    A bit more about callback. Callback class extends CWS_ConrollerWidget_Abstract and has internal property _params which is the mix of containerParams and inner template Params. Using this property widgets may exchange by their params since it passed by refference in constructor. For example Online Stuff and Online Users need one parameter 'usersOnline'. One of them calculates it, another borrows it from the first. At home page nobody calculates it since it prepared in the index controller.

    Callback method is similar to action in regular controller. Widget should return ResponseView (or Template object, or string).
    These are examples of callbacks.

    class CWS_ControllerWidget_Default extends CWS_ControllerWidget_Abstract
    // The default sidebar generated by XenForo. We already have it in container data
    public function actionDefaultSidebar()
            return !empty(
    $this->_params['sidebar']) ? $this->_params['sidebar'] : '';
    // Online Users
    public function actionOnlineUsers()
    $visitor XenForo_Visitor::getInstance();
    /* @var $sessionModel XenForo_Model_Session */
    $sessionModel $this->getModelFromCache('XenForo_Model_Session');
    // Check if param is already calculated in controller or other widget
    $this->_params['onlineUsers'] = isset($this->_params['onlineUsers']) ? $this->_params['onlineUsers'] :
    'cutOff' => array('>'$sessionModel->getOnlineStatusTimeout())),
    $visitor['user_id'] ? $visitor->toArray() : null)
    CFodder likes this.
  5. CFodder

    CFodder Well-Known Member

    Thanks for your post and explanation.

    Unfortunately I'm not a developers ... anything really ... so the callback explanation you've put up is waaaay over my head. The reason I asked, is when I tried adding a widget it asked for the callback and method ... so that is my bad, I should've just used the widgets you had already.

    I do notice that when editing and then saving a widget it goes back to the home screen in the ACP ... a minor annoyance but thought I'd let you know :).
    guiltar likes this.
  6. guiltar

    guiltar Well-Known Member

    Thanks, I'll fix this incorrect redirect.

    For now I've added only widgets from the homepage.
    It's not enough for full blown widget system but enough for testing.
    I will add more widgets later. Actually end-users don't need to create widgets.
    They may use existing ones.

    BTW, to import current widgets you should install addd-on twice.
  7. guiltar

    guiltar Well-Known Member

    cclaerhout and resonansER like this.
  8. guiltar

    guiltar Well-Known Member

    The core seems to be almost done (last version on github).
    Now going to start making more widgets.
    So what widgets widgets are most necessary?
  9. cclaerhout

    cclaerhout Well-Known Member

    The only one I'm using right now is Today Birthdays (see this addon - I've just customized it a little to add a basic cache system)
    arms likes this.
  10. kkm323

    kkm323 Well-Known Member

    Can you share some screenshot ;)
  11. RobParker

    RobParker Well-Known Member

    Is this meant as an alternative to the widget framework and xenporta or something that complements them? See a few examples would be great :)
    giorgino likes this.
  12. Digital Doctor

    Digital Doctor Well-Known Member

    Yeah baby ! :)
    giorgino likes this.
  13. CFodder

    CFodder Well-Known Member

    Still a conflict with XFRocks widget framework, when both are installed it will only show one set of widgets, even when selecting the different lists.
  14. cclaerhout

    cclaerhout Well-Known Member

    After a few hours to manipulate the alpha 4 on Github (published a few months ago), this addon should be a very good one. It needs a few patches to make it work on XenForo 1.2, but the possibilities for developers are great. Come back and "finish the job James" ! ;)
    yavuz likes this.

Share This Page