namespace WPForms\Forms\Fields\Divider;
use WPForms\Forms\Fields\Traits\ProField as ProFieldTrait;
class Field extends WPForms_Field {
* Primary class constructor.
// Define field type information.
$this->name = esc_html__( 'Section Divider', 'wpforms-lite' );
$this->keywords = esc_html__( 'line, hr', 'wpforms-lite' );
$this->icon = 'fa-arrows-h';
$this->allow_read_only = false;
$this->default_settings = [
protected function hooks() {
* Field options panel inside the builder.
* @param array $field Field data.
public function field_options( $field ) {
'after_title' => $this->get_field_options_notice(),
$this->field_option( 'label', $field );
$this->field_option( 'description', $field );
// Set label to the disabled.
'slug' => 'label_disable',
$this->field_element( 'text', $field, $args );
$this->field_option( 'basic-options', $field, $args );
* Advanced field options.
$this->field_option( 'advanced-options', $field, $args );
$this->field_option( 'css', $field );
// Hide Divider Line toggle.
$this->hide_divider_line_option( $field );
$this->field_option( 'advanced-options', $field, $args );
* Hide the Divider Line option.
* @param array $field Field data.
private function hide_divider_line_option( array $field ): void {
$hide_divider_line_value = $field['hide_divider_line'] ?? '0';
$hide_divider_line = $this->field_element(
'slug' => 'hide_divider_line',
'value' => $hide_divider_line_value,
'desc' => esc_html__( 'Hide Divider Line', 'wpforms-lite' ),
'tooltip' => esc_html__( 'Do not show the horizontal divider line.', 'wpforms-lite' ),
'slug' => 'hide_divider_line',
'content' => $hide_divider_line,
* Field preview inside the builder.
* @param array $field Field data.
public function field_preview( $field ) {
$this->field_preview_option(
'label_badge' => $this->get_field_preview_badge(),
$this->field_preview_option( 'description', $field );
* Field display on the form front-end.
* @param array $field Field data and settings.
* @param array $deprecated Deprecated field attributes. Use field properties.
* @param array $form_data Form data and settings.
public function field_display( $field, $deprecated, $form_data ) {