BP_XProfile_Field_Type_Textarea::edit_field_html( array $raw_properties = array() )

Output the edit field HTML for this field type.


Description Description

Must be used inside the bp_profile_fields() template loop.


Top ↑

Parameters Parameters

$raw_properties

(array) (Optional) key/value array of permitted attributes that you want to add.

Default value: array()


Source Source

File: bp-xprofile/classes/class-bp-xprofile-field-type-textarea.php

	public function edit_field_html( array $raw_properties = array() ) {

		// User_id is a special optional parameter that certain other fields
		// types pass to {@link bp_the_profile_field_options()}.
		if ( isset( $raw_properties['user_id'] ) ) {
			unset( $raw_properties['user_id'] );
		}

		$richtext_enabled = bp_xprofile_is_richtext_enabled_for_field(); ?>

		<legend id="<?php bp_the_profile_field_input_name(); ?>-1">
			<?php bp_the_profile_field_name(); ?>
			<?php bp_the_profile_field_required_label(); ?>
		</legend>

		<?php

		/** This action is documented in bp-xprofile/bp-xprofile-classes */
		do_action( bp_get_the_profile_field_errors_action() );

		if ( ! $richtext_enabled ) {
			$r = wp_parse_args( $raw_properties, array(
				'cols' => 40,
				'rows' => 5,
			) );

			?>

			<textarea <?php echo $this->get_edit_field_html_elements( $r ); ?> aria-labelledby="<?php bp_the_profile_field_input_name(); ?>-1" aria-describedby="<?php bp_the_profile_field_input_name(); ?>-3"><?php bp_the_profile_field_edit_value(); ?></textarea>

			<?php

		} else {

			/**
			 * Filters the arguments passed to `wp_editor()` in richtext xprofile fields.
			 *
			 * @since 2.4.0
			 *
			 * @param array $args {
			 *     Array of optional arguments. See `wp_editor()`.
			 *     @type bool $teeny         Whether to use the teeny version of TinyMCE. Default true.
			 *     @type bool $media_buttons Whether to show media buttons. Default false.
			 *     @type bool $quicktags     Whether to show the quicktags buttons. Default true.
			 *     @type int  $textarea_rows Number of rows to display in the editor. Defaults to 1 in the
			 *                               'admin' context, and 10 in the 'edit' context.
			 * }
			 * @param string $context The display context. 'edit' when the markup is intended for the
			 *                        profile edit screen, 'admin' when intended for the Profile Fields
			 *                        Dashboard panel.
			 */
			$editor_args = apply_filters( 'bp_xprofile_field_type_textarea_editor_args', array(
				'teeny'         => true,
				'media_buttons' => false,
				'quicktags'     => true,
				'textarea_rows' => 10,
			), 'edit' );

			wp_editor(
				bp_get_the_profile_field_edit_value(),
				bp_get_the_profile_field_input_name(),
				$editor_args
			);
		}

		if ( bp_get_the_profile_field_description() ) : ?>
			<p class="description" id="<?php bp_the_profile_field_input_name(); ?>-3"><?php bp_the_profile_field_description(); ?></p>
		<?php endif;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.