@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected $form_id; |
46 | 46 | |
47 | - function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null) { |
|
47 | + function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null ) { |
|
48 | 48 | |
49 | 49 | // Backward compat |
50 | - if ( ! empty( $item['type'] ) ) { |
|
51 | - $item['input_type'] = $item['type']; |
|
52 | - unset( $item['type'] ); |
|
50 | + if ( ! empty( $item[ 'type' ] ) ) { |
|
51 | + $item[ 'input_type' ] = $item[ 'type' ]; |
|
52 | + unset( $item[ 'type' ] ); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | if ( $admin_label = \GV\Utils::get( $settings, 'admin_label' ) ) { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $this->id = $item_id; |
76 | 76 | $this->form_id = $form_id; |
77 | 77 | $this->settings = $settings; |
78 | - $this->label_type = $item['label_type']; |
|
78 | + $this->label_type = $item[ 'label_type' ]; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | |
120 | 120 | foreach ( $field_info_items as $item ) { |
121 | 121 | |
122 | - if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
122 | + if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
123 | 123 | continue; |
124 | 124 | } |
125 | 125 | |
126 | - $class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description'; |
|
126 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
127 | 127 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
128 | 128 | $output .= '<span class="' . $class . '">'; |
129 | - $output .= esc_html( $item['value'] ); |
|
129 | + $output .= esc_html( $item[ 'value' ] ); |
|
130 | 130 | $output .= '</span>'; |
131 | 131 | } |
132 | 132 | |
@@ -154,21 +154,21 @@ discard block |
||
154 | 154 | |
155 | 155 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
156 | 156 | // TODO: Un-hack this |
157 | - $hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
157 | + $hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
158 | 158 | $settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) ); |
159 | 159 | |
160 | 160 | // Should we show the icon that the field is being used as a link to single entry? |
161 | - $hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : ''; |
|
161 | + $hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : ''; |
|
162 | 162 | $show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>'; |
163 | 163 | |
164 | 164 | // When a field label is empty, use the Field ID |
165 | 165 | $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
166 | 166 | |
167 | 167 | // If there's a custom label, and show label is checked, use that as the field heading |
168 | - if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) { |
|
169 | - $label = $this->settings['custom_label']; |
|
170 | - } else if ( ! empty( $this->item['customLabel'] ) ) { |
|
171 | - $label = $this->item['customLabel']; |
|
168 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
169 | + $label = $this->settings[ 'custom_label' ]; |
|
170 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
171 | + $label = $this->item[ 'customLabel' ]; |
|
172 | 172 | } |
173 | 173 | $label = esc_attr( $label ); |
174 | 174 | |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | |
177 | 177 | $output .= '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">'; |
178 | 178 | |
179 | - if ( ! empty( $this->item['parent'] ) ) { |
|
180 | - $label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>'; |
|
179 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
180 | + $label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>'; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // Name of field / widget |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | |
194 | 194 | $output .= '</h5>'; |
195 | 195 | |
196 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
197 | - $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
196 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
197 | + $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
198 | 198 | |
199 | - $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>'; |
|
199 | + $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
200 | 200 | |
201 | 201 | return $output; |
202 | 202 | } |