BP_Core_Friends_Widget::form( array $instance )
Render the widget edit form.
Description
Parameters
- $instance
-
(Required) The saved widget settings.
Return
(void)
Source
File: bp-friends/classes/class-bp-core-friends-widget.php
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | function form( $instance ) { $defaults = array ( 'max_friends' => 5, 'friend_default' => 'active' , 'link_title' => false ); $instance = wp_parse_args( ( array ) $instance , $defaults ); $max_friends = $instance [ 'max_friends' ]; $friend_default = $instance [ 'friend_default' ]; $link_title = (bool) $instance [ 'link_title' ]; ?> <p><label for = "<?php echo $this->get_field_id( 'link_title' ); ?>" ><input type= "checkbox" name= "<?php echo $this->get_field_name('link_title'); ?>" id= "<?php echo $this->get_field_id( 'link_title' ); ?>" value= "1" <?php checked( $link_title ); ?> /> <?php _e( 'Link widget title to Members directory' , 'buddyboss' ); ?></label></p> <p><label for = "<?php echo $this->get_field_id( 'max_friends' ); ?>" ><?php _e( 'Max connections to show:' , 'buddyboss' ); ?> <input class = "widefat" id= "<?php echo $this->get_field_id( 'max_friends' ); ?>" name= "<?php echo $this->get_field_name( 'max_friends' ); ?>" type= "text" value= "<?php echo absint( $max_friends ); ?>" style= "width: 30%" /></label></p> <p> <label for = "<?php echo $this->get_field_id( 'friend_default' ) ?>" ><?php _e( 'Default connections to show:' , 'buddyboss' ); ?></label> <select name= "<?php echo $this->get_field_name( 'friend_default' ); ?>" id= "<?php echo $this->get_field_id( 'friend_default' ); ?>" > <option value= "newest" <?php selected( $friend_default , 'newest' ); ?>><?php _e( 'Newest' , 'buddyboss' ); ?></option> <option value= "active" <?php selected( $friend_default , 'active' );?>><?php _e( 'Active' , 'buddyboss' ); ?></option> <option value= "popular" <?php selected( $friend_default , 'popular' ); ?>><?php _e( 'Popular' , 'buddyboss' ); ?></option> </select> </p> <?php } |
Changelog
Version | Description |
---|---|
BuddyPress 1.9.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.