| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.4/wp-content/plugins/fluentform/app/Services/FormBuilder/ |
Upload File : |
<?php
namespace FluentForm\App\Services\FormBuilder;
defined('ABSPATH') or die;
use FluentForm\App\Services\FormBuilder\Components\BaseComponent;
abstract class BaseFieldManager extends BaseComponent
{
protected $key = '';
protected $title = '';
protected $tags = [];
protected $position = 'advanced';
public function __construct($key, $title, $tags = [], $position = 'advanced')
{
parent::__construct();
$this->key = $key;
$this->position = $position;
$this->title = $title;
$this->tags = $tags;
$this->register();
}
public function register()
{
add_filter('fluentform/editor_components', [$this, 'pushComponent']);
add_filter('fluentform/editor_element_settings_placement', [$this, 'pushEditorElementPositions']);
add_filter('fluentform/editor_element_search_tags', [$this, 'pushTags'], 10, 2);
add_action('fluentform/render_item_' . $this->key, [$this, 'render'], 10, 2);
/*
* This is internal use.
* Push field type to the fluentform field types to be available in FormFieldParser.
*/
add_filter('fluentform/form_input_types', [$this, 'pushFormInputType']);
add_filter('fluentform/editor_element_customization_settings', function ($settings) {
if ($customSettings = $this->getEditorCustomizationSettings()) {
$settings = array_merge($settings, $customSettings);
}
return $settings;
});
add_filter('fluentform/supported_conditional_fields', [$this, 'pushConditionalSupport']);
}
public function pushConditionalSupport($conditonalItems)
{
$conditonalItems[] = $this->key;
return $conditonalItems;
}
public function pushFormInputType($types)
{
$types[] = $this->key;
return $types;
}
public function pushComponent($components)
{
$component = $this->getComponent();
if ($component) {
$components[$this->position][] = $component;
}
return $components;
}
public function pushEditorElementPositions($placement_settings)
{
$placement_settings[$this->key] = [
'general' => $this->getGeneralEditorElements(),
'advanced' => $this->getAdvancedEditorElements(),
'generalExtras' => $this->generalEditorElement(),
'advancedExtras' => $this->advancedEditorElement(),
];
return $placement_settings;
}
public function generalEditorElement()
{
return [];
}
public function advancedEditorElement()
{
return [];
}
public function getGeneralEditorElements()
{
return [
'label',
'admin_field_label',
'placeholder',
'label_placement',
'validation_rules',
];
}
public function getAdvancedEditorElements()
{
return [
'name',
'help_message',
'container_class',
'class',
'conditional_logics',
];
}
public function getEditorCustomizationSettings()
{
return [];
}
public function pushTags($tags, $form)
{
if ($this->tags) {
$tags[$this->key] = $this->tags;
}
return $tags;
}
abstract public function getComponent();
abstract public function render($element, $form);
}