Can I use a widget on a view???

I need to use a widget on the sidebar of a plugin, can i do that???

I'm trying this:

elgg_extend_view('page/elements/sidebar','event_manager/views/default/events/content');

(Plugin: Event Manager)

But that doesn't work.

 

Any ideas???

  • you might be able to replicate the contents that way, it wouldn't be a widget in the full sense of it - ie. it wouldn't have the editable options or be able to move.  Also keep in mind though, that the view may rely on $vars to be passed to it, including $vars['entity'] which would be the widget object itself...

  • Ok, I'll keep that in mind. The code above doesn't work, it doesn't show anything. I'm not interested in the full widget functionality, just the content of that widget.

    Maybe, I need to do the functionality of that widget on a plugin instead of use the widget :/

  • Your code is wrong. You dont have to include the view path. Just call it like

    elgg_extend_view('page/elements/sidebar','events/content');

    Everything inside views can be called, just by the above call. But remember that elgg treats each widget as an entity and the contents to display depend on many properties like widget owner, number of items to display etc.. 

Feedback and Planning

Feedback and Planning

Discussions about the past, present, and future of Elgg and this community site.