We have moved to Github. Please open tickets there.

Opened 2 years ago

Closed 2 years ago

#2779 closed Defect (fixed)

Widgets: get_widget_types() unexpected behavior

Reported by: coldtrick Owned by:
Priority: normal Milestone: Elgg 1.7.7
Component: Core Version: 1.7
Severity: minor Keywords: widgets, widget
Cc: brett@… Difficulty: easy

Description

in engine/lib/widgets the function get_widget_types() unsets $CONFIG values.

when you ask get_widget_types() more than once in a page run for different contexts this can result is widgets disappearing.

Use case:
I have registered a widget just for "profile" (see add_widget_type()) and in one page run I ask for the widgets on "dashboard" and then "profile" my widget will not show up. If however I ask the widgets for "profile" and then "dashboard" it will.

Solution:
get_widget_types() should NOT unset $CONFIG but just build a result set and return this.

Change History (3)

comment:1 Changed 2 years ago by cash

  • Difficulty set to easy
  • Milestone changed from Needs Review to Elgg 1.7.7

This has been fixed in svn trunk: take a look at http://trac.elgg.org/browser/elgg/trunk/engine/lib/widgets.php#L223

I think if you replace elgg_get_context() with get_context() it will work. If so, we can merge that into the 1.7 branch.

comment:2 Changed 2 years ago by coldtrick

Cash,

sorry didn't check trunk. I don't think it needs to be committed to Elgg 1.7 (I worked around the problem).
The solution in trunk should work just fine. So if this is in 1.8 we can rework the plugin then to use the new functions.

comment:3 Changed 2 years ago by cash

  • Resolution set to fixed
  • Status changed from new to closed

(In [svn:7965]) Fixes #2779 can now call get_widget_types() more than once

Note: See TracTickets for help on using tickets.