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

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