| Server IP : 43.130.17.34 / Your IP : 216.73.217.6 Web Server : nginx/1.28.0 System : Linux VM-4-12-opencloudos 6.6.92-34.1.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 25 21:32:13 CST 2025 x86_64 User : www ( 1000) PHP Version : 8.0.26 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 MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/yespkg.com/wp-content/plugins/wpforms/src/Pro/Forms/Fields/Layout/ |
Upload File : |
<?php
namespace WPForms\Pro\Forms\Fields\Layout;
use WPForms\Pro\Forms\Fields\Traits\Layout\Frontend as LayoutFrontendTrait;
/**
* The Layout field's Frontend class.
*
* @since 1.8.9
*/
class Frontend {
use LayoutFrontendTrait {
hooks as trait_hooks;
}
/**
* Register hooks.
*
* @since 1.8.9
*/
private function hooks() {
$this->trait_hooks();
add_filter( "wpforms_field_properties_{$this->field_obj->type}", [ $this, 'field_properties' ], 10, 3 );
add_action( 'wpforms_display_field_before', [ $this, 'field_label' ], 15, 2 );
}
/**
* Define additional field properties.
*
* @since 1.9.0
*
* @param array $properties Field properties.
* @param array $field Field settings.
* @param array $form_data Form data and settings.
*
* @return array
* @noinspection PhpMissingParamTypeInspection
* @noinspection PhpUnusedParameterInspection
*/
public function field_properties( $properties, $field, $form_data ): array { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
// Disable default label.
$properties['label']['disabled'] = true;
$properties['description']['position'] = 'before';
return $properties;
}
/**
* Display the custom field label.
*
* @since 1.9.0
*
* @param array|mixed $field Field data and settings.
* @param array $form_data Form data and settings.
*
* @noinspection PhpUnusedParameterInspection
*/
public function field_label( $field, array $form_data ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
$field = (array) $field;
if ( ! isset( $field['type'] ) || $field['type'] !== $this->field_obj->type ) {
return;
}
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->get_title( $field );
}
/**
* Get the title.
*
* @since 1.9.0
*
* @param array $field Field settings.
*
* @return string
*/
private function get_title( array $field ): string {
if ( ! empty( $field['label_hide'] ) ) {
return '';
}
return sprintf(
'<h3 class="wpforms-field-label">
%1$s
</h3>',
esc_html( $field['label'] )
);
}
}