BP_Blogs_Recent_Posts_Widget::form( array $instance )

Output the networkwide posts widget options form.


Parameters Parameters

$instance

(array) (Required) Settings for this widget.


Top ↑

Return Return

(void)


Source Source

File: bp-blogs/classes/class-bp-blogs-recent-posts-widget.php

	public function form( $instance ) {
		$instance = wp_parse_args( (array) $instance, array(
			'title'      => __( 'Recent Networkwide Posts', 'buddypress' ),
			'max_posts'  => 10,
			'link_title' => false,
		) );

		$max_limit = bp_get_widget_max_count_limit( __CLASS__ );

		$title      = strip_tags( $instance['title'] );
		$max_posts  = $instance['max_posts'] > $max_limit ? $max_limit : intval( $instance['max_posts'] );
		$link_title = (bool) $instance['link_title'];

		?>

		<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _ex( 'Title:', 'Label for the Title field of the Recent Networkwide Posts widget', 'buddypress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" style="width: 100%;" /></label></p>
		<p><label for="<?php echo $this->get_field_id( 'link_title' ); ?>"><input type="checkbox" name="<?php echo $this->get_field_name( 'link_title' ); ?>" value="1" <?php checked( $link_title ); ?> /> <?php _e( 'Link widget title to Blogs directory', 'buddypress' ); ?></label></p>
		<p><label for="<?php echo $this->get_field_id( 'max_posts' ); ?>"><?php _e( 'Max posts to show:', 'buddypress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_posts' ); ?>" name="<?php echo $this->get_field_name( 'max_posts' ); ?>" type="number" min="1" max="<?php echo esc_attr( $max_limit ); ?>" value="<?php echo esc_attr( $max_posts ); ?>" style="width: 30%" /></label></p>
		<?php
	}


Top ↑

User Contributed Notes User Contributed Notes

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