PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.9.2
Pods – Custom Content Types and Fields v3.3.9.2
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 / PodsWidgetForm.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
PodsWidgetForm.php
85 lines
1 <?php
2
3 // Don't load directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 die( '-1' );
6 }
7
8 /**
9 * @package Pods\Widgets
10 */
11 class PodsWidgetForm extends WP_Widget {
12
13 /**
14 * {@inheritdoc}
15 */
16 public function __construct( $id_base = '', $name = '', $widget_options = array(), $control_options = array() ) {
17
18 parent::__construct( 'pods_widget_form', __( 'Pods - Form', 'pods' ), array(
19 'classname' => 'pods_widget_form',
20 'description' => __( 'Display a form for creating and editing Pod items', 'pods' ),
21 ), array( 'width' => 200 ) );
22
23 }
24
25 /**
26 * {@inheritdoc}
27 */
28 public function widget( $args, $instance ) {
29
30 // Setup basic widget parameters.
31 $before_widget = pods_v( 'before_widget', $args );
32 $after_widget = pods_v( 'after_widget', $args );
33 $before_title = pods_v( 'before_title', $args );
34 $title = apply_filters( 'widget_title', pods_v( 'title', $instance ) );
35 $after_title = pods_v( 'after_title', $args );
36 $before_content = pods_v( 'before_content', $instance );
37 $after_content = pods_v( 'after_content', $instance );
38
39 $args = array(
40 'name' => trim( (string) pods_v( 'pod_type', $instance, '' ) ),
41 'slug' => trim( (string) pods_v( 'slug', $instance, '' ) ),
42 'fields' => trim( (string) pods_v( 'fields', $instance, '' ) ),
43 'label' => trim( (string) pods_v( 'label', $instance, __( 'Submit', 'pods' ), true ) ),
44 'thank_you' => trim( (string) pods_v( 'thank_you', $instance, '' ) ),
45 'form' => 1,
46 );
47
48 if ( 0 < strlen( $args['name'] ) ) {
49 require PODS_DIR . 'ui/front/widgets.php';
50 }
51 }
52
53 /**
54 * {@inheritdoc}
55 */
56 public function update( $new_instance, $old_instance ) {
57
58 $instance = $old_instance;
59
60 $instance['title'] = pods_v( 'title', $new_instance, '' );
61 $instance['pod_type'] = pods_v( 'pod_type', $new_instance, '' );
62 $instance['slug'] = pods_v( 'slug', $new_instance, '' );
63 $instance['fields'] = pods_v( 'fields', $new_instance, '' );
64 $instance['label'] = pods_v( 'label', $new_instance, __( 'Submit', 'pods' ), true );
65 $instance['thank_you'] = pods_v( 'thank_you', $new_instance, '' );
66
67 return $instance;
68 }
69
70 /**
71 * {@inheritdoc}
72 */
73 public function form( $instance ) {
74
75 $title = pods_v( 'title', $instance, '' );
76 $pod_type = pods_v( 'pod_type', $instance, '' );
77 $slug = pods_v( 'slug', $instance, '' );
78 $fields = pods_v( 'fields', $instance, '' );
79 $label = pods_v( 'label', $instance, __( 'Submit', 'pods' ), true );
80 $thank_you = pods_v( 'thank_you', $instance, '' );
81
82 require PODS_DIR . 'ui/admin/widgets/form.php';
83 }
84 }
85