PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 1.2.4
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v1.2.4
6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 3.6.66 All 195 releases
fluentform / app / Modules / Form / FormFieldsParser.php

FormFieldsParser.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 1.2.4, at app/Modules/Form/FormFieldsParser.php

54 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Modules\Form;
4
5 use FluentForm\App\Services\FormParser;
6
7 class FormFieldsParser
8 {
9 protected static $forms = array();
10
11 public static function getFields($form, $asArray = false)
12 {
13 return static::parse('fields', $form, $asArray);
14 }
15
16 public function getInputs($form, $with = [])
17 {
18 return static::parse('inputs', $form, $with);
19 }
20
21 public function getEntryInputs($form, $with = ['admin_label'])
22 {
23 return static::parse('entry_inputs', $form, $with);
24 }
25
26 public function parse($key, $form, $with)
27 {
28 if (!isset(static::$forms[$form->id])) {
29 static::$forms[$form->id] = array();
30 }
31
32 if (!isset(static::$forms[$form->id][$key])) {
33 $parser = new FormParser($form);
34 $method = str_replace(' ', '', ucwords(str_replace('_', ' ', $key)));
35 static::$forms[$form->id][$key] = $parser->{'get'.$method}($with);
36 }
37
38 return static::$forms[$form->id][$key];
39 }
40
41 public static function getAdminLabels($form, $fields = [])
42 {
43 if (!isset(static::$forms[$form->id])) {
44 static::$forms[$form->id] = array();
45 }
46
47 if (!isset(static::$forms[$form->id]['admin_labels'])) {
48 $parser = new FormParser($form);
49 static::$forms[$form->id]['admin_labels'] = $parser->getAdminLabels($fields);
50 }
51
52 return static::$forms[$form->id]['admin_labels'];
53 }
54 }