Skip to content

Commit

Permalink
Hide disabled connectors on list table filter dropdown
Browse files Browse the repository at this point in the history
Introduce new filter: 'wp_stream_list_table_show_disabled_connectors'
to toggle the visibility.
  • Loading branch information
Dzikri Aziz committed Feb 19, 2014
1 parent 3e96c01 commit ea9b54d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions includes/list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,24 @@ function assemble_records( $column, $table = '' ) {
}
} else {
$all_records = WP_Stream_Connectors::$term_labels['stream_' . $column ];

if ( 'connector' === $column ) {
/**
* Toggle visibility of disabled connectors on list table filter dropdown
*
* @param bool $hidden Visibility status, hidden by default.
*/
$hide_disabled_connectors_filter = apply_filters( 'wp_stream_list_table_show_disabled_connectors', true );

if ( true === $hide_disabled_connectors_filter ) {
$active_connectors = WP_Stream_Settings::$options['connectors_active_connectors'];
foreach ( array_keys( $all_records ) as $_connector ) {
if ( ! in_array( $_connector, $active_connectors ) ) {
unset( $all_records[ $_connector ] );
}
}
}
}
}

$existing_records = existing_records( $column, $table );
Expand Down

0 comments on commit ea9b54d

Please sign in to comment.