PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.11
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.11
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.11, at includes/fields/class-field-column.php

128 lines 4.4 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 $use_theme_css = isset( $form_settings['use_theme_css'] ) ? $form_settings['use_theme_css'] : 'wpuf-style';
26 $i = 1;
27 $columns = $field_settings['columns'];
28 $columns_size = $field_settings['inner_columns_size'];
29 $column_space = $field_settings['column_space'];
30 $inner_fields = $field_settings['inner_fields'];
31 $atts = []; ?>
32 <li class="wpuf-el">
33 <div class="wpuf-field-columns <?php echo 'has-columns-' . esc_attr( $columns ); ?>" data-style="<?php echo esc_attr( $use_theme_css ); ?>">
34 <div class="wpuf-column-field-inner-columns">
35 <div class="wpuf-column">
36 <?php while ( $i <= $columns ) { ?>
37 <div class="<?php echo 'column-' . esc_attr( $i ) . ' items-of-column-' . esc_attr( $columns ); ?> wpuf-column-inner-fields">
38 <ul class="wpuf-column-fields">
39 <?php weforms()->fields->render_fields( $inner_fields['column-' . $i], $form_id, $atts, $type, $post_id ); ?>
40 </ul>
41 </div>
42
43 <?php $i++; ?>
44 <?php } ?>
45 </div>
46 </div>
47 </div>
48 </li>
49 <?php
50 }
51
52 /**
53 * It's a full width block
54 *
55 * @return bool
56 */
57 public function is_full_width() {
58 return true;
59 }
60
61 /**
62 * Get field options setting
63 *
64 * @return array
65 */
66 public function get_options_settings() {
67 $options = [
68 [
69 'name' => 'columns',
70 'title' => __( 'Number of Columns', 'weforms' ),
71 'type' => 'range',
72 'section' => 'basic',
73 'priority' => 10,
74 'help_text' => __( 'Title of the section', 'weforms' ),
75 ],
76 [
77 'name' => 'column_space',
78 'title' => __( 'Space Between Columns', 'weforms' ),
79 'type' => 'text',
80 'section' => 'basic',
81 'priority' => 11,
82 'help_text' => __( 'Add padding space between columns. e.g: 10', 'weforms' ),
83 ],
84 [
85 'name' => 'css',
86 'title' => __( 'CSS Class Name', 'weforms' ),
87 'type' => 'text',
88 'section' => 'advanced',
89 'priority' => 22,
90 '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' ),
91 ],
92 ];
93
94 return apply_filters( 'wpuf_text_field_option_settings', $options );
95 }
96
97 /**
98 * Get the field props
99 *
100 * @return array
101 */
102 public function get_field_props() {
103 $props = [
104 'input_type' => 'column_field',
105 'template' => $this->get_type(),
106 'id' => 0,
107 'is_new' => true,
108 'is_meta' => 'no',
109 'columns' => 3,
110 'min_column' => 1,
111 'max_column' => 3,
112 'column_space' => '5',
113 'inner_fields' => [
114 'column-1' => [],
115 'column-2' => [],
116 'column-3' => [],
117 ],
118 'inner_columns_size' => [
119 'column-1' => '33.33%',
120 'column-2' => '33.33%',
121 'column-3' => '33.33%',
122 ],
123 ];
124
125 return $props;
126 }
127 }
128