[buddypress-trac] [BuddyPress Trac] #7226: Update BP_buttons class to accept new arg param for $element_type

buddypress-trac noreply at wordpress.org
Wed Aug 24 09:52:36 UTC 2016

#7226: Update BP_buttons class to accept new arg param for $element_type
 Reporter:  hnla         |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  2.7
Component:  Core         |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |

Comment (by boonebgorges):

 Thanks for your work on these patches, @hnla. Aside from some code
 formatting issues (indentation, etc), the approach looks good.

 A question about parameter names and element types. You're using
 `button_type`, `button_name`, `button_value`. Maybe these could be renamed
 `type`, `name`, and `value`? That way, if we ever decide to allow
 `BP_Button` to create elements of type `input`, we could reuse the same

 In the documentation, you say that `button_type` accepts 'button' or
 'submit'. Should this be enforced? (IMO, no - it's implied that the
 developer should adhere to HTML spec. We should remove the "accepts"
 language from the parameter documentation for this reason, and just in
 case they decide to add more possible values, like 'reset'.)

 `data_attr` is a bit funky, because it asks for fully formed attribute
 name-value strings. Is it overkill to accept an array and parse it? Eg:

 'data_attr' => array(
     'bp-buttons' => 'foo,bar',
     'whatever' => 'baz',

 which would become ` data-bp-buttons="foo,bar" data-whatever="baz"`? This
 could be useful elsewhere in BP.

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7226#comment:7>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list