Changeset 13692 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins-2024/inc/block-config.php
- Timestamp:
- 05/13/2024 02:05:49 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins-2024/inc/block-config.php
r13451 r13692 9 9 add_filter( 'wporg_query_filter_options_sort', __NAMESPACE__ . '\wporg_query_filter_options_sort' ); 10 10 add_filter( 'wporg_query_filter_options_business_model', __NAMESPACE__ . '\wporg_query_filter_options_business_model' ); 11 add_filter( 'wporg_query_filter_options_plugin_category', __NAMESPACE__ . '\wporg_query_filter_options_plugin_category' ); 11 12 add_filter( 'wporg_query_filter_in_form', __NAMESPACE__ . '\wporg_query_filter_in_form' ); 12 13 add_filter( 'wporg_query_total_label', __NAMESPACE__ . '\wporg_query_total_label', 10, 2 ); … … 129 130 function wporg_query_filter_options_business_model() { 130 131 $options = array( 132 'all' => __( 'All', 'wporg-plugins' ), 131 133 'commercial' => __( 'Commercial', 'wporg-plugins' ), 132 'community' => __( 'Community', 'wporg-plugins' ),134 'community' => __( 'Community', 'wporg-plugins' ), 133 135 ); 134 136 $label = __( 'Type', 'wporg-plugins' ); … … 144 146 'options' => $options , 145 147 'selected' => [ get_query_var( 'plugin_business_model' ) ], 148 ); 149 } 150 151 function wporg_query_filter_options_plugin_category() { 152 $options = []; 153 154 foreach ( get_terms( 'plugin_category', [ 'hide_empty' => true ] ) as $term ) { 155 $options[ $term->slug ] = $term->name; 156 } 157 158 $count = count( (array) get_query_var( 'plugin_category' ) ); 159 $label = sprintf( 160 /* translators: The dropdown label for filtering, %s is the selected term count. */ 161 _n( 'Categories <span>%s</span>', 'Categories <span>%s</span>', number_format_i18n( $count ), 'wporg-plugins' ), 162 $count 163 ); 164 165 return array( 166 'label' => $label, 167 'title' => __( 'Category', 'wporg-plugins' ), 168 'key' => 'plugin_category', 169 'action' => '', 170 'options' => $options, 171 'selected' => (array) get_query_var( 'plugin_category' ), 146 172 ); 147 173 } … … 186 212 } 187 213 214 // Temporary for feature flag 215 if ( isset( $_GET['show_filters'] ) ) { 216 echo '<input type="hidden" name="show_filters" value="1" />'; 217 } 218 188 219 } 189 220
Note: See TracChangeset
for help on using the changeset viewer.