- Timestamp:
- 10/12/2015 05:50:45 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-textarea.php
r10179 r10254 27 27 $this->category = _x( 'Single Fields', 'xprofile field type category', 'buddypress' ); 28 28 $this->name = _x( 'Multi-line Text Area', 'xprofile field type', 'buddypress' ); 29 $this->supports_richtext = true; 29 30 30 31 $this->set_format( '/^.*$/m', 'replace' ); … … 60 61 } 61 62 62 $r = bp_parse_args( $raw_properties, array( 63 'cols' => 40, 64 'rows' => 5, 65 ) ); ?> 63 $richtext_enabled = bp_xprofile_is_richtext_enabled_for_field(); ?> 66 64 67 65 <label for="<?php bp_the_profile_field_input_name(); ?>"> … … 73 71 74 72 /** This action is documented in bp-xprofile/bp-xprofile-classes */ 75 do_action( bp_get_the_profile_field_errors_action() ); ?>73 do_action( bp_get_the_profile_field_errors_action() ); 76 74 77 <textarea <?php echo $this->get_edit_field_html_elements( $r ); ?>><?php bp_the_profile_field_edit_value(); ?></textarea> 75 if ( ! $richtext_enabled ) { 76 $r = wp_parse_args( $raw_properties, array( 77 'cols' => 40, 78 'rows' => 5, 79 ) ); 78 80 79 <?php 81 ?> 82 83 <textarea <?php echo $this->get_edit_field_html_elements( $r ); ?>><?php bp_the_profile_field_edit_value(); ?></textarea> 84 85 <?php 86 87 } else { 88 89 /** 90 * Filters the arguments passed to `wp_editor()` in richtext xprofile fields. 91 * 92 * @since 2.4.0 93 * 94 * @param array $args { 95 * Array of optional arguments. See `wp_editor()`. 96 * @type bool $teeny Whether to use the teeny version of TinyMCE. Default true. 97 * @type bool $media_buttons Whether to show media buttons. Default false. 98 * @type bool $quicktags Whether to show the quicktags buttons. Default true. 99 * } 100 */ 101 $editor_args = apply_filters( 'bp_xprofile_field_type_textarea_editor_args', array( 102 'teeny' => true, 103 'media_buttons' => false, 104 'quicktags' => true, 105 ) ); 106 107 wp_editor( 108 bp_get_the_profile_field_edit_value(), 109 bp_get_the_profile_field_input_name(), 110 $editor_args 111 ); 112 } 80 113 } 81 114 … … 90 123 */ 91 124 public function admin_field_html( array $raw_properties = array() ) { 92 $r = bp_parse_args( $raw_properties, array( 93 'cols' => 40, 94 'rows' => 5, 95 ) ); ?> 125 $richtext_enabled = bp_xprofile_is_richtext_enabled_for_field(); 96 126 97 <textarea <?php echo $this->get_edit_field_html_elements( $r ); ?>></textarea>127 if ( ! $richtext_enabled ) { 98 128 99 <?php 129 $r = bp_parse_args( $raw_properties, array( 130 'cols' => 40, 131 'rows' => 5, 132 ) ); ?> 133 134 <textarea <?php echo $this->get_edit_field_html_elements( $r ); ?>></textarea> 135 136 <?php 137 } else { 138 139 /** This filter is documented in bp-xprofile/classes/class-bp-xprofile-field-type-textarea.php */ 140 $editor_args = apply_filters( 'bp_xprofile_field_type_textarea_editor_args', array( 141 'teeny' => true, 142 'media_buttons' => false, 143 'quicktags' => true, 144 ) ); 145 146 wp_editor( 147 '', 148 'xprofile_textarea_' . bp_get_the_profile_field_id(), 149 $editor_args 150 ); 151 } 100 152 } 101 153
Note: See TracChangeset
for help on using the changeset viewer.