Skip to:
Content

BuddyPress.org

Changeset 7067


Ignore:
Timestamp:
05/15/2013 12:17:48 AM (9 years ago)
Author:
boonebgorges
Message:

Miscellaneous cleanup in BP_Blogs_Recent_Posts_Widget

  • Adds 'description' param to the constructor, to provide better context for admins using the Dashboard > Widgets panel
  • Adds 'classname' param to the constructor, to ensure that widget styling is properly applied on secondary sites
  • Use WP_Widget::get_field_id() for label "for" attribute, as per spec
  • Whitespace
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs/bp-blogs-widgets.php

    r7066 r7067  
    2020add_action( 'bp_register_widgets', 'bp_blogs_register_widgets' );
    2121
     22/**
     23 * The Recent Networkwide Posts widget
     24 */
    2225class BP_Blogs_Recent_Posts_Widget extends WP_Widget {
    2326
    2427    function __construct() {
    25         parent::__construct( false, $name = _x( '(BuddyPress) Recent Networkwide Posts', 'widget name', 'buddypress' ) );
     28        $widget_ops = array(
     29            'description' => __( 'A list of recently published posts from across your network.', 'buddypress' ),
     30            'classname'   => 'widget_bp_blogs_widget buddypress',
     31        );
     32        parent::__construct( false, $name = _x( '(BuddyPress) Recent Networkwide Posts', 'widget name', 'buddypress' ), $widget_ops );
    2633    }
    2734
    28     function widget($args, $instance) {
     35    function widget( $args, $instance ) {
    2936
    3037        $title = ! empty( $instance['title'] ) ? esc_html( $instance['title'] ) : __( 'Recent Networkwide Posts', 'buddypress' );
     
    101108        <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>
    102109        <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>
    103         <p><label for="bp-blogs-widget-posts-max"><?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="text" value="<?php echo esc_attr( $max_posts ); ?>" style="width: 30%" /></label></p>
    104     <?php
     110        <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="text" value="<?php echo esc_attr( $max_posts ); ?>" style="width: 30%" /></label></p>
     111        <?php
    105112    }
    106113}
Note: See TracChangeset for help on using the changeset viewer.