Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/29/2016 09:58:29 AM (8 years ago)
Author:
hnla
Message:

Update 'bp_profile_get_settings_visibity_select()' function args

  • Add new args to support elements before & after for the form controls.
  • Add class attr for form label & notoggle elements.
  • Add arg for notoggle tags element.

Update allows developers to manage markup output directly from template, providing an additional set of elements to wrap form controls to allow for styling hooks to change select styling, changing of classes for label & notoggle elements to suit & changing the notoggle tags element if required.

Fixes #7364

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-template.php

    r11239 r11258  
    13591359     *    @type int    $field_id ID of the field to render.
    13601360     *    @type string $before   Markup to render before the field.
     1361     *    @type string $before_controls  markup before form controls.
    13611362     *    @type string $after    Markup to render after the field.
     1363     *    @type string $after_controls Markup after the form controls.
    13621364     *    @type string $class    Class to apply to the field markup.
     1365     *    @type string $label_class Class to apply for the label element.
     1366     *    @type string $notoggle_tag Markup element to use for notoggle tag.
     1367     *    @type string $notoggle_class Class to apply to the notoggle element.
    13631368     * }
    13641369     * @return string $retval
     
    13681373        // Parse optional arguments.
    13691374        $r = bp_parse_args( $args, array(
    1370             'field_id' => bp_get_the_profile_field_id(),
    1371             'before'   => '',
    1372             'after'    => '',
    1373             'class'    => 'bp-xprofile-visibility'
     1375            'field_id'         => bp_get_the_profile_field_id(),
     1376            'before'           => '',
     1377            'before_controls'  => '',
     1378            'after'            => '',
     1379            'after_controls'   => '',
     1380            'class'            => 'bp-xprofile-visibility',
     1381            'label_class'      => 'bp-screen-reader-text',
     1382            'notoggle_tag'     => 'span',
     1383            'notoggle_class'   => 'field-visibility-settings-notoggle',
    13741384        ), 'xprofile_settings_visibility_select' );
    13751385
     
    13881398            <?php if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
    13891399
    1390                 <label for="<?php echo esc_attr( 'field_' . $r['field_id'] ) ; ?>_visibility" class="bp-screen-reader-text"><?php
     1400            <?php echo $r['before_controls']; ?>
     1401
     1402                <label for="<?php echo esc_attr( 'field_' . $r['field_id'] ) ; ?>_visibility" class="<?php echo esc_attr( $r['label_class'] ); ?>"><?php
    13911403                    /* translators: accessibility text */
    13921404                    _e( 'Select visibility', 'buddypress' );
     
    14021414                </select>
    14031415
     1416            <?php echo $r['after_controls']; ?>
     1417
    14041418            <?php else : ?>
    14051419
    1406                 <span class="field-visibility-settings-notoggle"><?php bp_the_profile_field_visibility_level_label(); ?></span>
     1420                <<?php echo esc_html( $r['notoggle_tag'] ); ?> class="<?php echo esc_attr( $r['notoggle_class'] ); ?>"><?php bp_the_profile_field_visibility_level_label(); ?></<?php echo esc_html( $r['notoggle_tag'] ); ?>>
    14071421
    14081422            <?php endif;
Note: See TracChangeset for help on using the changeset viewer.