PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.5
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.5
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
weforms / includes / fields / class-field-column.php

class-field-column.php in weForms – Easy Drag & Drop Contact Form Builder For WordPress 1.6.5, at includes/fields/class-field-column.php

127 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Column Field Class
5 */
6 class WeForms_Form_Field_Column extends WeForms_Field_Contract {
7
8 public function __construct() {
9 $this->name = __( 'Columns', 'weforms' );
10 $this->input_type = 'column_field';
11 $this->icon = 'columns';
12 }
13
14 /**
15 * Render the Column field
16 *
17 * @param array $field_settings
18 * @param int $form_id
19 * @param string $type
20 * @param int $post_id
21 *
22 * @return void
23 */
24 public function render( $field_settings, $form_id, $type = 'post', $post_id = null ) {
25 $i = 1;
26 $columns = $field_settings['columns'];
27 $columns_size = $field_settings['inner_columns_size'];
28 $column_space = $field_settings['column_space'];
29 $inner_fields = $field_settings['inner_fields'];
30 $atts = []; ?>
31 <li class="wpuf-el">
32 <div class="wpuf-field-columns <?php echo 'has-columns-' . esc_attr( $columns ); ?>">
33 <div class="wpuf-column-field-inner-columns">
34 <div class="wpuf-column">
35 <?php while ( $i <= $columns ) { ?>
36 <div class="<?php echo 'column-' . esc_attr( $i ) . ' items-of-column-' . esc_attr( $columns ); ?> wpuf-column-inner-fields">
37 <ul class="wpuf-column-fields">
38 <?php weforms()->fields->render_fields( $inner_fields['column-' . $i], $form_id, $atts, $type, $post_id ); ?>
39 </ul>
40 </div>
41
42 <?php $i++; ?>
43 <?php } ?>
44 </div>
45 </div>
46 </div>
47 </li>
48 <?php
49 }
50
51 /**
52 * It's a full width block
53 *
54 * @return bool
55 */
56 public function is_full_width() {
57 return true;
58 }
59
60 /**
61 * Get field options setting
62 *
63 * @return array
64 */
65 public function get_options_settings() {
66 $options = [
67 [
68 'name' => 'columns',
69 'title' => __( 'Number of Columns', 'weforms' ),
70 'type' => 'range',
71 'section' => 'basic',
72 'priority' => 10,
73 'help_text' => __( 'Title of the section', 'weforms' ),
74 ],
75 [
76 'name' => 'column_space',
77 'title' => __( 'Space Between Columns', 'weforms' ),
78 'type' => 'text',
79 'section' => 'basic',
80 'priority' => 11,
81 'help_text' => __( 'Add padding space between columns. e.g: 10', 'weforms' ),
82 ],
83 [
84 'name' => 'css',
85 'title' => __( 'CSS Class Name', 'weforms' ),
86 'type' => 'text',
87 'section' => 'advanced',
88 'priority' => 22,
89 'help_text' => __( 'Provide a container class name for this field. Available classes: wpuf-col-half, wpuf-col-half-last, wpuf-col-one-third, wpuf-col-one-third-last', 'weforms' ),
90 ],
91 ];
92
93 return apply_filters( 'wpuf_text_field_option_settings', $options );
94 }
95
96 /**
97 * Get the field props
98 *
99 * @return array
100 */
101 public function get_field_props() {
102 $props = [
103 'input_type' => 'column_field',
104 'template' => $this->get_type(),
105 'id' => 0,
106 'is_new' => true,
107 'is_meta' => 'no',
108 'columns' => 3,
109 'min_column' => 1,
110 'max_column' => 3,
111 'column_space' => '5',
112 'inner_fields' => [
113 'column-1' => [],
114 'column-2' => [],
115 'column-3' => [],
116 ],
117 'inner_columns_size' => [
118 'column-1' => '33.33%',
119 'column-2' => '33.33%',
120 'column-3' => '33.33%',
121 ],
122 ];
123
124 return $props;
125 }
126 }
127