Skip to:
Content

bbPress.org

Changeset 5833


Ignore:
Timestamp:
07/15/2015 01:59:26 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Add ability to use icons as column headers ala Comment bubbles (off by default.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/actions.php

    r5770 r5833  
    9090add_filter( 'dashboard_glance_items', 'bbp_filter_dashboard_glance_items', -99 );
    9191
     92// Maybe use icons for column headers
     93add_filter( 'bbp_admin_forums_column_headers',  'bbp_filter_column_headers' );
     94add_filter( 'bbp_admin_topics_column_headers',  'bbp_filter_column_headers' );
     95add_filter( 'bbp_admin_replies_column_headers', 'bbp_filter_column_headers' );
     96
    9297/**
    9398 * When a new site is created in a multisite installation, run the activation
     
    120125}
    121126
     127/**
     128 * Show icons in list-table column headers instead of strings
     129 *
     130 * @since bbPress (r5833)
     131 *
     132 * @param  array $columns Column headers fed into list-table objects
     133 *
     134 * @return array Possibly altered column headers
     135 */
     136function bbp_filter_column_headers( $columns = array() ) {
     137
     138    // Do not filter column headers by default - maybe we'll turn it on later
     139    if ( ! apply_filters( 'bbp_filter_column_headers', false ) ) {
     140        return $columns;
     141    }
     142
     143    /** Forums ****************************************************************/
     144
     145    // Forum topic count
     146    if ( isset( $columns[ 'bbp_forum_topic_count' ] ) ) {
     147        $columns[ 'bbp_forum_topic_count' ] = '<span class="vers bbp_topics_column"  title="' . esc_attr__( 'Topics', 'bbpress' ) . '"><span class="screen-reader-text">' . esc_html__( 'Topics', 'bbpress' ) . '</span></span>';
     148    }
     149
     150    // Forum reply count
     151    if ( isset( $columns[ 'bbp_forum_reply_count' ] ) ) {
     152        $columns[ 'bbp_forum_reply_count' ] = '<span class="vers bbp_replies_column"  title="' . esc_attr__( 'Replies', 'bbpress' ) . '"><span class="screen-reader-text">' . esc_html__( 'Replies', 'bbpress' ) . '</span></span>';
     153    }
     154
     155    /** Topics ****************************************************************/
     156
     157    // Topic forum
     158    if ( isset( $columns[ 'bbp_topic_forum' ] ) ) {
     159        $columns[ 'bbp_topic_forum' ] = '<span class="vers bbp_forums_column"  title="' . esc_attr__( 'Forum', 'bbpress' ) . '"><span class="screen-reader-text">' . esc_html__( 'Forum', 'bbpress' ) . '</span></span>';
     160    }
     161
     162    // Topic reply count
     163    if ( isset( $columns[ 'bbp_topic_reply_count' ] ) ) {
     164        $columns[ 'bbp_topic_reply_count' ] = '<span class="vers bbp_replies_column"  title="' . esc_attr__( 'Replies', 'bbpress' ) . '"><span class="screen-reader-text">' . esc_html__( 'Replies', 'bbpress' ) . '</span></span>';
     165    }
     166
     167    /** Replies ***************************************************************/
     168
     169    // Reply forum
     170    if ( isset( $columns[ 'bbp_reply_forum' ] ) ) {
     171        $columns[ 'bbp_reply_forum' ] = '<span class="vers bbp_forums_column"  title="' . esc_attr__( 'Forum', 'bbpress' ) . '"><span class="screen-reader-text">' . esc_html__( 'Forum', 'bbpress' ) . '</span></span>';
     172    }
     173
     174    // Reply topic
     175    if ( isset( $columns[ 'bbp_reply_topic' ] ) ) {
     176        $columns[ 'bbp_reply_topic' ] = '<span class="vers bbp_topics_column"  title="' . esc_attr__( 'Topic', 'bbpress' ) . '"><span class="screen-reader-text">' . esc_html__( 'Topic', 'bbpress' ) . '</span></span>';
     177    }
     178
     179    return $columns;
     180}
     181
    122182/** Sub-Actions ***************************************************************/
    123183
Note: See TracChangeset for help on using the changeset viewer.