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 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / classes / widgets / PodsWidgetList.php
pods / classes / widgets Last commit date
PodsWidgetField.php 2 days ago PodsWidgetForm.php 2 days ago PodsWidgetList.php 2 days ago PodsWidgetSingle.php 2 days ago PodsWidgetView.php 2 days ago
PodsWidgetList.php
98 lines
1 <?php
2
3 /**
4 * @package Pods\Widgets
5 */
6 class PodsWidgetList extends WP_Widget {
7
8 /**
9 * {@inheritdoc}
10 */
11 public function __construct( $id_base = '', $name = '', $widget_options = array(), $control_options = array() ) {
12
13 parent::__construct( 'pods_widget_list', __( 'Pods - List Items', 'pods' ), array(
14 'classname' => 'pods_widget_list',
15 'description' => __( 'Display multiple Pod items', 'pods' ),
16 ), array( 'width' => 200 ) );
17
18 }
19
20 /**
21 * {@inheritdoc}
22 */
23 public function widget( $args, $instance ) {
24
25 // Setup basic widget parameters.
26 $before_widget = pods_v( 'before_widget', $args );
27 $after_widget = pods_v( 'after_widget', $args );
28 $before_title = pods_v( 'before_title', $args );
29 $title = apply_filters( 'widget_title', pods_v( 'title', $instance ) );
30 $after_title = pods_v( 'after_title', $args );
31 $before_content = pods_v( 'before_content', $instance );
32 $after_content = pods_v( 'after_content', $instance );
33
34 $args = array(
35 'name' => trim( (string) pods_v( 'pod_type', $instance, '' ) ),
36 'template' => trim( (string) pods_v( 'template', $instance, '' ) ),
37 'limit' => (int) pods_v( 'limit', $instance, 15, true ),
38 'orderby' => trim( (string) pods_v( 'orderby', $instance, '' ) ),
39 'where' => trim( (string) pods_v( 'where', $instance, '' ) ),
40 'expires' => (int) trim( (string) pods_v( 'expires', $instance, ( 60 * 5 ) ) ),
41 'cache_mode' => trim( (string) pods_v( 'cache_mode', $instance, 'none', true ) ),
42 );
43
44 if ( ! pods_can_use_dynamic_feature_sql_clauses() ) {
45 $args['orderby'] = '';
46 $args['where'] = $args['where'] ? '0=1 /* Dynamic SQL clauses disabled in Pods */' : '';
47 }
48
49 $content = trim( (string) pods_v( 'template_custom', $instance, '' ) );
50
51 if ( 0 < strlen( $args['name'] ) && ( 0 < strlen( $args['template'] ) || 0 < strlen( $content ) ) ) {
52 require PODS_DIR . 'ui/front/widgets.php';
53 }
54 }
55
56 /**
57 * {@inheritdoc}
58 */
59 public function update( $new_instance, $old_instance ) {
60
61 $instance = $old_instance;
62
63 $instance['title'] = pods_v( 'title', $new_instance, '' );
64 $instance['pod_type'] = pods_v( 'pod_type', $new_instance, '' );
65 $instance['template'] = pods_v( 'template', $new_instance, '' );
66 $instance['template_custom'] = pods_v( 'template_custom', $new_instance, '' );
67 $instance['limit'] = (int) pods_v( 'limit', $new_instance, 15, true );
68 $instance['orderby'] = pods_v( 'orderby', $new_instance, '' );
69 $instance['where'] = pods_v( 'where', $new_instance, '' );
70 $instance['expires'] = (int) pods_v( 'expires', $new_instance, ( 60 * 5 ) );
71 $instance['cache_mode'] = pods_v( 'cache_mode', $new_instance, 'none' );
72 $instance['before_content'] = pods_v( 'before_content', $new_instance, '' );
73 $instance['after_content'] = pods_v( 'after_content', $new_instance, '' );
74
75 return $instance;
76 }
77
78 /**
79 * {@inheritdoc}
80 */
81 public function form( $instance ) {
82
83 $title = pods_v( 'title', $instance, '' );
84 $pod_type = pods_v( 'pod_type', $instance, '' );
85 $template = pods_v( 'template', $instance, '' );
86 $template_custom = pods_v( 'template_custom', $instance, '' );
87 $limit = (int) pods_v( 'limit', $instance, 15, true );
88 $orderby = pods_v( 'orderby', $instance, '' );
89 $where = pods_v( 'where', $instance, '' );
90 $expires = (int) pods_v( 'expires', $instance, ( 60 * 5 ) );
91 $cache_mode = pods_v( 'cache_mode', $instance, 'none' );
92 $before_content = pods_v( 'before_content', $instance, '' );
93 $after_content = pods_v( 'after_content', $instance, '' );
94
95 require PODS_DIR . 'ui/admin/widgets/list.php';
96 }
97 }
98