Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 3 years ago

#7695 closed enhancement (wontfix)

Move widget markup to theme templates

Reported by: boonebgorges Owned by:
Priority: normal Milestone:
Component: Templates Version:
Severity: normal Keywords: 2nd-opinion
Cc:

Description

Widget markup is currently hardcoded into the widget classes. See eg BP_Groups_Widget::widget(). This is bad for two broad reasons:

  1. AJAX callbacks have to completely duplicate the markup. That is: on first render, BP_Groups_Widget::widget() builds the markup, but when you click one of the AJAX filters like 'Active', it's built completely separately by groups_ajax_widget_groups_list().
  1. In general, there are no hooks or filters available within the widget() methods to customize output. Your only choice is to fork the widget, which because of 1, also means forking the AJAX callback.

The most natural way to solve this would be by moving the markup to template files, which could then be overridden in the normal WP way. That change would require a bit of thought, as we'd need to have an idiomatic way of passing in the $args and $instance variables from the WP_Widget::widget() method; while they'd be in scope inside of get_template_part(), we generally use template functions rather than directly referencing variables in templates.

There are other ways to increase customizability, but I think this is the most WPish way. What do others think?

Change History (6)

#1 @boonebgorges
8 years ago

Possibly related: #7159

This ticket was mentioned in Slack in #buddypress by dcavins. View the logs.


8 years ago

#3 @DJPaul
8 years ago

  • Milestone Awaiting ReviewUnder Consideration

Broadly agree that this would be nice, and would fit in line with moving the profile field type partials out.
Do you have interest in doing this work for one of the next few releases?

#4 @DJPaul
8 years ago

  • Component CoreTemplates
  • Milestone Under ConsiderationAwaiting Contributions

#5 @DJPaul
8 years ago

  • Type defect (bug)enhancement

#6 @imath
3 years ago

  • Milestone Awaiting Contributions
  • Resolutionwontfix
  • Status newclosed

Widgets were moved into BP Classic after being deprecated in favor of blocks.

Note: See TracTickets for help on using tickets.