PluginProbe
Pods – Custom Content Types and Fields / 3.2.8.4
Pods – Custom Content Types and Fields v3.2.8.4
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 All 42 releases
pods / ui / front / filters.php
filters.php
39 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Don't load directly.
3 if ( ! defined( 'ABSPATH' ) ) {
4 die( '-1' );
5 }
6
7 /**
8 * @var Pods $pod
9 * @var array<string,\Pods\Whatsit\Field> $fields
10 * @var string $action
11 * @var string $search
12 * @var string $label
13 */
14 ?>
15 <form method="get" class="pods-form-filters pods-form-filters-<?php echo esc_attr( $pod->pod ); ?>" action="<?php echo esc_attr( $action ); ?>">
16 <?php
17 foreach ( $fields as $name => $field ) {
18 if ( in_array( $field['type'], array( 'pick', 'taxonomy' ), true ) && 'pick-custom' !== $field['pick_object'] && ! empty( $field['pick_object'] ) ) {
19 $field['pick_format_type'] = 'single';
20 $field['pick_format_single'] = 'dropdown';
21 $field['pick_select_text'] = '-- ' . $field['label'] . ' --';
22 $field['pick_show_select_text'] = 1;
23 $field['pick_select_text_always_show'] = 1;
24
25 $filter = sanitize_text_field( pods_v( $pod->filter_var . '_' . $name, 'get', '' ) );
26
27 // @todo Support other field types.
28 $field['type'] = 'pick';
29
30 echo PodsForm::field( $pod->filter_var . '_' . $name, $filter, $field['type'], $field, $pod->pod, $pod->id() );
31 }
32 }
33 ?>
34
35 <input type="text" class="pods-form-filters-search" name="<?php echo esc_attr( $pod->search_var ); ?>" value="<?php echo esc_attr( $search ); ?>" />
36
37 <input type="submit" class="pods-form-filters-submit" value="<?php echo esc_attr( $label ); ?>" />
38 </form>
39