protected function getGroupName() {
return 'changes';
}
+
+ /**
+ * Get filters that can be rendered.
+ *
+ * Filters with 'msg' => false can be used to filter data but won't
+ * be presented as show/hide toggles in the UI. They are not returned
+ * by this function.
+ *
+ * @param array $allFilters Map of filter URL param names to properties (msg/default)
+ * @return array Map of filter URL param names to properties (msg/default)
+ */
+ protected function getRenderableCustomFilters( $allFilters ) {
+ return array_filter(
+ $allFilters,
+ function( $filter ) {
+ return isset( $filter['msg'] ) && ( $filter['msg'] !== false );
+ }
+ );
+ }
}
}
/**
- * Get custom show/hide filters
+ * Get all custom filters
*
* @return array Map of filter URL param names to properties (msg/default)
*/
$showhide = [ 'show', 'hide' ];
- foreach ( $this->getCustomFilters() as $key => $params ) {
+ foreach ( $this->getRenderableCustomFilters( $this->getCustomFilters() ) as $key => $params ) {
$filters[$key] = $params['msg'];
}
+
// Disable some if needed
if ( !$user->useRCPatrol() ) {
unset( $filters['hidepatrolled'] );
}
/**
- * Get custom show/hide filters
+ * Get all custom filters
*
* @return array Map of filter URL param names to properties (msg/default)
*/
$filters['hidecategorization'] = 'wlshowhidecategorization';
}
- foreach ( $this->getCustomFilters() as $key => $params ) {
+ foreach ( $this->getRenderableCustomFilters( $this->getCustomFilters() ) as $key => $params ) {
$filters[$key] = $params['msg'];
}
+
// Disable some if needed
if ( !$user->useRCPatrol() ) {
unset( $filters['hidepatrolled'] );