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

buddypress-trac noreply at wordpress.org
Mon Sep 19 02:40:28 UTC 2016


#7226: Update BP_buttons class to accept new arg param for $element_type
-------------------------+---------------------
 Reporter:  hnla         |       Owner:  r-a-y
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:  2.7
Component:  Core         |     Version:
 Severity:  normal       |  Resolution:  fixed
 Keywords:  has-patch    |
-------------------------+---------------------
Changes (by r-a-y):

 * owner:   => r-a-y
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"11114"]:
 {{{
 #!CommitTicketReference repository="" revision="11114"
 Core: Refactor `BP_Button` class to use an easier syntax.

 Previously, to use the `BP_Button` class, a dev would have to define
 several parameters in order to render the HTML element for a button:

 array(
   'wrapper' => 'div',
   'wrapper_id' => 'my-wrapper',
   'wrapper_class' => 'my-wrapper-class',
   'link_href' => 'hxxp://example.com',
   'link_class' => 'my-link-class',
   'link_id' => 'my-link-id',
   'link_rel' => 'nofollow',
   'link_title' => 'my-link-title'
 )

 This commit simplifies the syntax to:

 array(
   'parent_element' => 'div',
   'parent_attr' => array(
     'id' => 'my-wrapper',
     'class' => 'my-wrapper-class'
   ),
   'button_attr' => array(
     'href' => 'hxxp://example.com',
     'class' => 'my-link-class',
     'id' => 'my-link-id',
     'rel' => 'nofollow',
     'title' => 'my-link-title'
   )
 )

 The `'parent_attr'` and `'button_attr'` parameters can use any arbitrary
 HTML attribute set as the array key.

 This commit also means we are deprecating the older parameters listed in
 the first example.  However, we still support these parameters via
 backward
 compatibility.

 Fixes #7226.
 }}}

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


More information about the buddypress-trac mailing list