Skip to:

Opened 3 years ago

Last modified 3 years ago

#6109 new enhancement

Re-factor BP template tags generating markup to parse args for attr/tokens

Reported by: hnla Owned by:
Milestone: Awaiting Contributions Priority: normal
Severity: normal Version:
Component: Core Keywords: needs-patch


As discussed briefly: in slack this ticket is to cover the updating of those template tag functions that generate markup to accept arg arrays to allow devs/users to pass additional class tokens, and general html element attributes.
Two example functions that this might benefit from are:

bp_profile_group_tabs() to further extend the classes e.g adding .active in addition to .current.

bp_field_css_class( 'editfield' ); where attempting to pass an additional string into this function results in the two being concatenated with a hyphen.

The process will likely employ 'bp_parse_args()' to catch and merge args with any default ones set on a given function.

Initial steps required:

  1. List functions requiring attention?
  1. Decide on a suitable nonamclature for the array names/keys so we have meaningful/memorable names that make sense and suggest their purpose.
  1. Establish a suitable approach that is re-usable across functions?

The reasoning behind this is that there are often times where simple access to markup is required, an additional class being a perfect example. Where we have markup generation in core files access is not always straightforward, filtering is not always an option as can be too laboured for the level of requirement. With the increasing propensity for frameworks in themes/theme creation there will be an increased requirement to be able to make use of the styling classes provided as the quickest option for pulling markup into shape.

I'll happily make a first pass attempt at re-factoring an example function - probably profile group tabs - as a proof of concept once we have a tentative agreement on the process required.

Change History (2)

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

3 years ago

#2 @DJPaul
3 years ago

  • Keywords dev-feedback removed
  • Milestone changed from 2.3 to Future Release

This sounds like a good set of improvements.

Note: See TracTickets for help on using tickets.