| @@ -1,8 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace FluentForm\App\Services\FormBuilder; |
| 4 | 4 | |
| 5 | +defined('ABSPATH') or die; | |
| 6 | + | |
| 5 | 7 | use FluentForm\App\Services\FormBuilder\Components\BaseComponent; |
| 6 | 8 | |
| 7 | 9 | abstract class BaseFieldManager extends BaseComponent |
| 8 | 10 | { |
| @@ -12,8 +14,9 @@ | ||
| 12 | 14 | protected $position = 'advanced'; |
| 13 | 15 | |
| 14 | 16 | public function __construct($key, $title, $tags = [], $position = 'advanced') |
| 15 | 17 | { |
| 18 | + parent::__construct(); | |
| 16 | 19 | $this->key = $key; |
| 17 | 20 | $this->position = $position; |
| 18 | 21 | $this->title = $title; |
| 19 | 22 | $this->tags = $tags; |
| @@ -21,19 +24,19 @@ | ||
| 21 | 24 | } |
| 22 | 25 | |
| 23 | 26 | public function register() |
| 24 | 27 | { |
| 25 | - add_filter('fluent_editor_components', array($this, 'pushComponent')); | |
| 26 | - add_filter('fluent_editor_element_settings_placement', array($this, 'pushEditorElementPositions')); | |
| 27 | - add_filter('fluent_editor_element_search_tags', array($this, 'pushTags'), 10, 2); | |
| 28 | - add_action('fluentform_render_item_' . $this->key, array($this, 'render'), 10, 2); | |
| 28 | + add_filter('fluentform/editor_components', [$this, 'pushComponent']); | |
| 29 | + add_filter('fluentform/editor_element_settings_placement', [$this, 'pushEditorElementPositions']); | |
| 30 | + add_filter('fluentform/editor_element_search_tags', [$this, 'pushTags'], 10, 2); | |
| 31 | + add_action('fluentform/render_item_' . $this->key, [$this, 'render'], 10, 2); | |
| 29 | 32 | /* |
| 30 | 33 | * This is internal use. |
| 31 | 34 | * Push field type to the fluentform field types to be available in FormFieldParser. |
| 32 | 35 | */ |
| 33 | - add_filter('fluentform_form_input_types', array($this, 'pushFormInputType')); | |
| 36 | + add_filter('fluentform/form_input_types', [$this, 'pushFormInputType']); | |
| 34 | 37 | |
| 35 | - add_filter('fluent_editor_element_customization_settings', function ($settings) { | |
| 38 | + add_filter('fluentform/editor_element_customization_settings', function ($settings) { | |
| 36 | 39 | if ($customSettings = $this->getEditorCustomizationSettings()) { |
| 37 | 40 | $settings = array_merge($settings, $customSettings); |
| 38 | 41 | } |
| 39 | 42 | |
| @@ -39,11 +42,9 @@ | ||
| 39 | 42 | |
| 40 | 43 | return $settings; |
| 41 | 44 | }); |
| 42 | 45 | |
| 43 | - | |
| 44 | - add_filter('fluentform_supported_conditional_fields', array($this, 'pushConditionalSupport')); | |
| 45 | - | |
| 46 | + add_filter('fluentform/supported_conditional_fields', [$this, 'pushConditionalSupport']); | |
| 46 | 47 | } |
| 47 | 48 | |
| 48 | 49 | public function pushConditionalSupport($conditonalItems) |
| 49 | 50 | { |
| @@ -69,14 +70,14 @@ | ||
| 69 | 70 | } |
| 70 | 71 | |
| 71 | 72 | public function pushEditorElementPositions($placement_settings) |
| 72 | 73 | { |
| 73 | - $placement_settings[$this->key] = array( | |
| 74 | - 'general' => $this->getGeneralEditorElements(), | |
| 75 | - 'advanced' => $this->getAdvancedEditorElements(), | |
| 76 | - 'generalExtras' => $this->generalEditorElement(), | |
| 77 | - 'advancedExtras' => $this->advancedEditorElement() | |
| 78 | - ); | |
| 74 | + $placement_settings[$this->key] = [ | |
| 75 | + 'general' => $this->getGeneralEditorElements(), | |
| 76 | + 'advanced' => $this->getAdvancedEditorElements(), | |
| 77 | + 'generalExtras' => $this->generalEditorElement(), | |
| 78 | + 'advancedExtras' => $this->advancedEditorElement(), | |
| 79 | + ]; | |
| 79 | 80 | |
| 80 | 81 | return $placement_settings; |
| 81 | 82 | } |
| 82 | 83 | |
| @@ -124,8 +125,8 @@ | ||
| 124 | 125 | } |
| 125 | 126 | return $tags; |
| 126 | 127 | } |
| 127 | 128 | |
| 128 | - abstract function getComponent(); | |
| 129 | + abstract public function getComponent(); | |
| 129 | 130 | |
| 130 | - abstract function render($element, $form); | |
| 131 | + abstract public function render($element, $form); | |
| 131 | 132 | } |