PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.2.2
Pods – Custom Content Types and Fields v3.2.2
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 / PodsWidgetForm.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
PodsWidgetForm.php
80 lines
1 <?php
2
3 /**
4 * @package Pods\Widgets
5 */
6 class PodsWidgetForm 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_form', __( 'Pods - Form', 'pods' ), array(
14 'classname' => 'pods_widget_form',
15 'description' => __( 'Display a form for creating and editing 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 'slug' => trim( (string) pods_v( 'slug', $instance, '' ) ),
37 'fields' => trim( (string) pods_v( 'fields', $instance, '' ) ),
38 'label' => trim( (string) pods_v( 'label', $instance, __( 'Submit', 'pods' ), true ) ),
39 'thank_you' => trim( (string) pods_v( 'thank_you', $instance, '' ) ),
40 'form' => 1,
41 );
42
43 if ( 0 < strlen( $args['name'] ) ) {
44 require PODS_DIR . 'ui/front/widgets.php';
45 }
46 }
47
48 /**
49 * {@inheritdoc}
50 */
51 public function update( $new_instance, $old_instance ) {
52
53 $instance = $old_instance;
54
55 $instance['title'] = pods_v( 'title', $new_instance, '' );
56 $instance['pod_type'] = pods_v( 'pod_type', $new_instance, '' );
57 $instance['slug'] = pods_v( 'slug', $new_instance, '' );
58 $instance['fields'] = pods_v( 'fields', $new_instance, '' );
59 $instance['label'] = pods_v( 'label', $new_instance, __( 'Submit', 'pods' ), true );
60 $instance['thank_you'] = pods_v( 'thank_you', $new_instance, '' );
61
62 return $instance;
63 }
64
65 /**
66 * {@inheritdoc}
67 */
68 public function form( $instance ) {
69
70 $title = pods_v( 'title', $instance, '' );
71 $pod_type = pods_v( 'pod_type', $instance, '' );
72 $slug = pods_v( 'slug', $instance, '' );
73 $fields = pods_v( 'fields', $instance, '' );
74 $label = pods_v( 'label', $instance, __( 'Submit', 'pods' ), true );
75 $thank_you = pods_v( 'thank_you', $instance, '' );
76
77 require PODS_DIR . 'ui/admin/widgets/form.php';
78 }
79 }
80