Skip to:
Content

BuddyPress.org

Ticket #7083: 7083.4.diff

File 7083.4.diff, 6.0 KB (added by dcavins, 9 years ago)

Wrap radio buttons options, checkbox options and datebox selects in div.

  • src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php

    diff --git src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php
    index 34d752d..d986cd0 100644
    class BP_XProfile_Field_Type_Checkbox extends BP_XProfile_Field_Type { 
    176176                        $html .= apply_filters( 'bp_get_the_profile_field_options_checkbox', $new_html, $options[$k], $this->field_obj->id, $selected, $k );
    177177                }
    178178
    179                 echo $html;
     179                printf( '<div id="%1$s" class="input-options checkbox-options">%2$s</div>',
     180                        esc_attr( 'field_' . $this->field_obj->id ),
     181                        $html
     182                );
    180183        }
    181184
    182185        /**
  • src/bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php

    diff --git src/bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php src/bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php
    index b0fb3cd..6074c5b 100644
    class BP_XProfile_Field_Type_Datebox extends BP_XProfile_Field_Type { 
    8585                                <?php bp_the_profile_field_required_label(); ?>
    8686                        </legend>
    8787
    88                         <?php
    89 
    90                         /**
    91                          * Fires after field label and displays associated errors for the field.
    92                          *
    93                          * This is a dynamic hook that is dependent on the associated
    94                          * field ID. The hooks will be similar to `bp_field_12_errors`
    95                          * where the 12 is the field ID. Simply replace the 12 with
    96                          * your needed target ID.
    97                          *
    98                          * @since 1.8.0
    99                          */
    100                         do_action( bp_get_the_profile_field_errors_action() ); ?>
    101 
    102                         <label for="<?php bp_the_profile_field_input_name(); ?>_day" class="<?php echo is_admin() ? 'screen-reader-text' : 'bp-screen-reader-text' ;?>"><?php
    103                                 /* translators: accessibility text */
    104                                 esc_html_e( 'Select day', 'buddypress' );
    105                         ?></label>
    106                         <select <?php echo $this->get_edit_field_html_elements( $day_r ); ?>>
    107                                 <?php bp_the_profile_field_options( array(
    108                                         'type'    => 'day',
    109                                         'user_id' => $user_id
    110                                 ) ); ?>
    111                         </select>
    112 
    113                         <label for="<?php bp_the_profile_field_input_name(); ?>_month" class="<?php echo is_admin() ? 'screen-reader-text' : 'bp-screen-reader-text' ;?>"><?php
    114                                 /* translators: accessibility text */
    115                                 esc_html_e( 'Select month', 'buddypress' );
    116                         ?></label>
    117                         <select <?php echo $this->get_edit_field_html_elements( $month_r ); ?>>
    118                                 <?php bp_the_profile_field_options( array(
    119                                         'type'    => 'month',
    120                                         'user_id' => $user_id
    121                                 ) ); ?>
    122                         </select>
    123 
    124                         <label for="<?php bp_the_profile_field_input_name(); ?>_year" class="<?php echo is_admin() ? 'screen-reader-text' : 'bp-screen-reader-text' ;?>"><?php
    125                                 /* translators: accessibility text */
    126                                 esc_html_e( 'Select year', 'buddypress' );
    127                         ?></label>
    128                         <select <?php echo $this->get_edit_field_html_elements( $year_r ); ?>>
    129                                 <?php bp_the_profile_field_options( array(
    130                                         'type'    => 'year',
    131                                         'user_id' => $user_id
    132                                 ) ); ?>
    133                         </select>
     88                        <div class="input-options datebox-selects">
     89
     90                                <?php
     91
     92                                /**
     93                                 * Fires after field label and displays associated errors for the field.
     94                                 *
     95                                 * This is a dynamic hook that is dependent on the associated
     96                                 * field ID. The hooks will be similar to `bp_field_12_errors`
     97                                 * where the 12 is the field ID. Simply replace the 12 with
     98                                 * your needed target ID.
     99                                 *
     100                                 * @since 1.8.0
     101                                 */
     102                                do_action( bp_get_the_profile_field_errors_action() ); ?>
     103
     104                                <label for="<?php bp_the_profile_field_input_name(); ?>_day" class="<?php echo is_admin() ? 'screen-reader-text' : 'bp-screen-reader-text' ;?>"><?php
     105                                        /* translators: accessibility text */
     106                                        esc_html_e( 'Select day', 'buddypress' );
     107                                ?></label>
     108                                <select <?php echo $this->get_edit_field_html_elements( $day_r ); ?>>
     109                                        <?php bp_the_profile_field_options( array(
     110                                                'type'    => 'day',
     111                                                'user_id' => $user_id
     112                                        ) ); ?>
     113                                </select>
     114
     115                                <label for="<?php bp_the_profile_field_input_name(); ?>_month" class="<?php echo is_admin() ? 'screen-reader-text' : 'bp-screen-reader-text' ;?>"><?php
     116                                        /* translators: accessibility text */
     117                                        esc_html_e( 'Select month', 'buddypress' );
     118                                ?></label>
     119                                <select <?php echo $this->get_edit_field_html_elements( $month_r ); ?>>
     120                                        <?php bp_the_profile_field_options( array(
     121                                                'type'    => 'month',
     122                                                'user_id' => $user_id
     123                                        ) ); ?>
     124                                </select>
     125
     126                                <label for="<?php bp_the_profile_field_input_name(); ?>_year" class="<?php echo is_admin() ? 'screen-reader-text' : 'bp-screen-reader-text' ;?>"><?php
     127                                        /* translators: accessibility text */
     128                                        esc_html_e( 'Select year', 'buddypress' );
     129                                ?></label>
     130                                <select <?php echo $this->get_edit_field_html_elements( $year_r ); ?>>
     131                                        <?php bp_the_profile_field_options( array(
     132                                                'type'    => 'year',
     133                                                'user_id' => $user_id
     134                                        ) ); ?>
     135                                </select>
     136
     137                        </div>
    134138
    135139                </fieldset>
    136140        <?php
  • src/bp-xprofile/classes/class-bp-xprofile-field-type-radiobutton.php

    diff --git src/bp-xprofile/classes/class-bp-xprofile-field-type-radiobutton.php src/bp-xprofile/classes/class-bp-xprofile-field-type-radiobutton.php
    index afe37d8..f8e0d5d 100644
    class BP_XProfile_Field_Type_Radiobutton extends BP_XProfile_Field_Type { 
    111111                $option_value = BP_XProfile_ProfileData::get_value_byid( $this->field_obj->id, $args['user_id'] );
    112112                $options      = $this->field_obj->get_children();
    113113
    114                 $html = sprintf( '<div id="%s">', esc_attr( 'field_' . $this->field_obj->id ) );
     114                $html = '';
    115115
    116116                for ( $k = 0, $count = count( $options ); $k < $count; ++$k ) {
    117117
    class BP_XProfile_Field_Type_Radiobutton extends BP_XProfile_Field_Type { 
    154154                        $html .= apply_filters( 'bp_get_the_profile_field_options_radio', $new_html, $options[$k], $this->field_obj->id, $selected, $k );
    155155                }
    156156
    157                 echo $html . '</div>';
     157                printf( '<div id="%1$s" class="input-options radio-button-options">%2$s</div>',
     158                        esc_attr( 'field_' . $this->field_obj->id ),
     159                        $html
     160                );
    158161        }
    159162
    160163        /**