[buddypress-trac] [BuddyPress Trac] #6521: Extended profile field name "Required" label produces odd HTML

buddypress-trac noreply at wordpress.org
Mon Jun 22 16:34:40 UTC 2015


#6521: Extended profile field name "Required" label produces odd HTML
----------------------------------+-----------------------------
 Reporter:  dcavins               |      Owner:
     Type:  defect (bug)          |     Status:  new
 Priority:  lowest                |  Milestone:  Awaiting Review
Component:  Component - XProfile  |    Version:  2.3.2
 Severity:  trivial               |   Keywords:
----------------------------------+-----------------------------
 When an extended profile field is required, we add the string "(required)"
 to the profile field name. The code has been formatted to make the php
 file easier to read, but the HTML that is output doesn't render well--
 leaving no space character between the field name and "(required)".

 The original php:
 {{{
 <label for="<?php bp_the_profile_field_input_name(); ?>">
         <?php bp_the_profile_field_name(); ?>
         <?php if ( bp_get_the_profile_field_is_required() ) : ?>
                 <?php esc_html_e( '(required)', 'buddypress' ); ?>
         <?php endif; ?>
 </label>
 }}}

 produces this ugly HTML due to the extra line breaks:
 {{{
 <label for="field_1">
                         Display Name
 (required)                                      </label>
 }}}


 This uglier php:
 {{{
 <label for="<?php bp_the_profile_field_input_name(); ?>"><?php
         bp_the_profile_field_name();
         if ( bp_get_the_profile_field_is_required() ) {
                 echo ' ';
                 esc_html_e( '(required)', 'buddypress' );
         }
 ?></label>
 }}}

 produces this nicer HTML:
 {{{
 <label for="field_1">Display Name (required)</label>
 }}}

 Can we strike a middle ground so that both the php formatting and the
 output HTML are acceptable?

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6521>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list