PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.2.4
Pods – Custom Content Types and Fields v3.2.4
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 3 years ago PodsWidgetForm.php 3 years ago PodsWidgetList.php 3 years ago PodsWidgetSingle.php 3 years ago PodsWidgetView.php 3 years ago
PodsWidgetList.php
93 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 $content = trim( (string) pods_v( 'template_custom', $instance, '' ) );
45
46 if ( 0 < strlen( $args['name'] ) && ( 0 < strlen( $args['template'] ) || 0 < strlen( $content ) ) ) {
47 require PODS_DIR . 'ui/front/widgets.php';
48 }
49 }
50
51 /**
52 * {@inheritdoc}
53 */
54 public function update( $new_instance, $old_instance ) {
55
56 $instance = $old_instance;
57
58 $instance['title'] = pods_v( 'title', $new_instance, '' );
59 $instance['pod_type'] = pods_v( 'pod_type', $new_instance, '' );
60 $instance['template'] = pods_v( 'template', $new_instance, '' );
61 $instance['template_custom'] = pods_v( 'template_custom', $new_instance, '' );
62 $instance['limit'] = (int) pods_v( 'limit', $new_instance, 15, true );
63 $instance['orderby'] = pods_v( 'orderby', $new_instance, '' );
64 $instance['where'] = pods_v( 'where', $new_instance, '' );
65 $instance['expires'] = (int) pods_v( 'expires', $new_instance, ( 60 * 5 ) );
66 $instance['cache_mode'] = pods_v( 'cache_mode', $new_instance, 'none' );
67 $instance['before_content'] = pods_v( 'before_content', $new_instance, '' );
68 $instance['after_content'] = pods_v( 'after_content', $new_instance, '' );
69
70 return $instance;
71 }
72
73 /**
74 * {@inheritdoc}
75 */
76 public function form( $instance ) {
77
78 $title = pods_v( 'title', $instance, '' );
79 $pod_type = pods_v( 'pod_type', $instance, '' );
80 $template = pods_v( 'template', $instance, '' );
81 $template_custom = pods_v( 'template_custom', $instance, '' );
82 $limit = (int) pods_v( 'limit', $instance, 15, true );
83 $orderby = pods_v( 'orderby', $instance, '' );
84 $where = pods_v( 'where', $instance, '' );
85 $expires = (int) pods_v( 'expires', $instance, ( 60 * 5 ) );
86 $cache_mode = pods_v( 'cache_mode', $instance, 'none' );
87 $before_content = pods_v( 'before_content', $instance, '' );
88 $after_content = pods_v( 'after_content', $instance, '' );
89
90 require PODS_DIR . 'ui/admin/widgets/list.php';
91 }
92 }
93