BP_XProfile_Field_Type_Social_Networks::edit_field_options_html( array $args = array() )
Output the edit field options HTML for this field type.
Description
BuddyPress considers a field’s "options" to be, for example, the items in a selectbox. These are stored separately in the database, and their templating is handled separately.
This templating is separate from BP_XProfile_Field_Type::edit_field_html() because it’s also used in the wp-admin screens when creating new fields, and for backwards compatibility.
Must be used inside the bp_profile_fields() template loop.
Parameters
- $args
-
(Optional) The arguments passed to bp_the_profile_field_options().
Default value: array()
Source
File: bp-xprofile/classes/class-bp-xprofile-field-type-social-networks.php
public function edit_field_options_html( array $args = array() ) { $original_option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $this->field_obj->id, $args['user_id'] ) ); $options = $this->field_obj->get_children(); $html = ''; $raw_properties = array(); if ( empty( $original_option_values ) && !empty( $_POST['field_' . $this->field_obj->id] ) ) { $original_option_values = sanitize_text_field( $_POST['field_' . $this->field_obj->id] ); } $option_values = ( $original_option_values ) ? (array) $original_option_values : array(); $providers = social_network_provider(); $field_name = bp_get_the_profile_field_input_name(); foreach ( $options as $option ) { $social_value = ( isset( $original_option_values ) && isset( $original_option_values[$option->name] ) ) ? $original_option_values[$option->name] : ''; $field = $this->get_edit_field_html_elements( array_merge( array( 'type' => 'text', 'name' => $field_name .'['.$option->name.']', 'id' => $field_name .'['.$option->name.']', 'value' => $social_value, ), $raw_properties ) ); $key = bp_social_network_search_key( $option->name, $providers); $html .= '<div class="editfield"><legend id="field_'.$option->id.'-1">'.$providers[$key]->name.'</legend> <input '.$field.'></div>'; } echo $html; }
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.