#7126 closed enhancement (fixed)
[BP Nouveau Request] create functions to get the component's button args
Reported by: | imath | Owned by: | imath |
---|---|---|---|
Milestone: | 11.0.0 | Priority: | normal |
Severity: | normal | Version: | 1.2 |
Component: | Templates | Keywords: | |
Cc: |
Description
Today the functions generating the buttons for loops or for the user profiles are doing something like this:
return bp_get_button( apply_filters( 'name_of_filter', $button_args ) );
So i have to do some funky stuff to only get the $button_args. Is there an objection if we create new functions to get these button args?
If function names are not great in the attach patch, we can change them to whatever you prefer.
Attachments (1)
Change History (20)
This ticket was mentioned in Slack in #buddypress by imath. View the logs.
8 years ago
This ticket was mentioned in Slack in #buddypress by djpaul. View the logs.
8 years ago
#7
@
8 years ago
- Keywords 2nd-opinion commit added
Run up against this working on the Nouveau button class and template tag updating to use the new button args for creating alternate button elements, wrappers and parent group elements: #7226
I'm patching my local for this 7126 patch so that I can check & configure our button function bp_nouveau_get_members_buttons()
Can we have 2nd pair of eyes on this patch ( imath had slight worry over function names ) to check over and commit - bear in mind as stated earlier this patch tends to bring the button into parity with others where we can get and set $button[] arg arrays and so is important in respect of simply unifying 'things'
#8
@
8 years ago
@hnla - If you're using the patch in #7226, can't you use the fifth parameter of the filter?
$this->contents = apply_filters( 'bp_button_' . $this->component . '_' . $this->id, $this->contents, $this, $before, $after, $r );
The $r
parameter should include all button arguments.
The dynamic naming of the filter (from when this was first implemented) might be problematic. If this is the case, let me know.
#9
@
8 years ago
@r-a-y thanks for looking.
tbh at this stage not 100% sure what specifically is an issue and would have to deconstruct further the current nouveau button functions, in reality I have ability to manipulate the button in question without seeming issue, sort of assumed the patch was required but it was built / required before we updated BP's button class, so guess the review really is whether the patch now is redundant or not!
#10
@
8 years ago
- Keywords 2nd-opinion commit removed
- Milestone 2.7 deleted
- Status changed from assigned to closed
#11
@
7 years ago
- Status changed from closed to reopened
Re-opening this ticket.
The issue remains valid .
if we look at the bp-friends template tag & functions changes in patch what we're attempting to do is separate the $args required for the friends buttons from the bp_get_button() return in bp_get_add_friend_button()
.
In Nouveau the buttons are built by fetching those args but this has the unintended effect of running bp_get_button() not desired! so Nouveau hacks a solution adding an empty array filtered to bp_get_add_friend_button
runs the function then unsets the filter, a tad ugly? Another consequence, maybe an edge case however... run the Nouveau files as a standalone theme or site and the late priority set on the filters fails and we get a duplicate button generated.
It seems to make sense to have the friend button args and switch as a separate function as the patch demonstrates, it's certainly more flexible than as currently setup!
#12
@
2 years ago
- Component changed from Core to Templates
- Milestone set to 11.0.0
As @hnla explained, looking at it again now I'm working on a renewed Nouveau template (See #8722), it doesn't make sense to use filters and globals to only get these buttons arguments. Let's have direct functions to get these!
Sure, we do this for most of the other buttons, right? Makes sense to have the same implementation. (haven't looked at the patch, but I'm assuming you want to 2.7 this).