Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/04/2015 02:27:22 AM (9 years ago)
Author:
dcavins
Message:

Introduce bp_the_profile_field_required_label().

Introduce a new template function,
bp_the_profile_field_required_label(), that
allows for translation and filtration of
‘required’ label for use with extended profile
fields.

Fixes #6521 and #6575.

File:
1 edited

Legend:

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

    r10163 r10179  
    13301330        return apply_filters( 'bp_profile_settings_visibility_select', $retval, $r, $args );
    13311331    }
     1332
     1333/**
     1334 * Output the 'required' markup in extended profile field labels.
     1335 *
     1336 * @since 2.4.0
     1337 *
     1338 * @return string HTML for the required label.
     1339 */
     1340function bp_the_profile_field_required_label() {
     1341    echo bp_get_the_profile_field_required_label();
     1342}
     1343
     1344    /**
     1345     * Return the 'required' markup in extended profile field labels.
     1346     *
     1347     * @since 2.4.0
     1348     *
     1349     * @return string HTML for the required label.
     1350     */
     1351    function bp_get_the_profile_field_required_label() {
     1352        $retval = '';
     1353
     1354        if ( bp_get_the_profile_field_is_required() ) {
     1355            $translated_string = __( ' (required)', 'buddypress' );
     1356
     1357            $retval = '<span class="bp-required-field-label">';
     1358            $retval .= apply_filters( 'bp_get_the_profile_field_required_label', $translated_string, bp_get_the_profile_field_id() );
     1359            $retval .= '</span>';
     1360
     1361        }
     1362
     1363        return $retval;
     1364    }
Note: See TracChangeset for help on using the changeset viewer.