Skip to:
Content

BuddyPress.org

Opened 7 years ago

Closed 10 months ago

#7695 closed enhancement (wontfix)

Move widget markup to theme templates

Reported by: boonebgorges's profile boonebgorges Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Templates 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
7 years ago

Possibly related: #7159

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


7 years ago

#3 @DJPaul
7 years ago

  • Milestone changed from Awaiting Review to Under 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
7 years ago

  • Component changed from Core to Templates
  • Milestone changed from Under Consideration to Awaiting Contributions

#5 @DJPaul
7 years ago

  • Type changed from defect (bug) to enhancement

#6 @imath
10 months ago

  • Milestone Awaiting Contributions deleted
  • Resolution set to wontfix
  • Status changed from new to closed

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

Note: See TracTickets for help on using tickets.