Noptin_Elementor_Forms_Integration::register_settings_section( ElementorWidget_Base $widget )

Register Settings Section


Description Description

Registers the Action controls


Top ↑

Parameters Parameters

$widget

(ElementorWidget_Base) (Required)


Top ↑

Source Source

File: includes/integrations/class-noptin-elementor-forms-integration.php

	public function register_settings_section( $widget ) {

		$widget->start_controls_section(
			'section_noptin',
			array(
				'label'     => $this->get_label(),
				'condition' => array(
					'submit_actions' => $this->get_name(),
				)
			)
		);

		$map_fields = array(

			array(
				'remote_id'       => 'first_name',
				'remote_label'    => __( 'First Name', 'newsletter-optin-box' ),
				'remote_type'     => 'text',
			),

			array(
				'remote_id'       => 'last_name',
				'remote_label'    => __( 'Last Name', 'newsletter-optin-box' ),
				'remote_type'     => 'text',
			),

			array(
				'remote_id'       => 'name',
				'remote_label'    => __( 'Full Name', 'newsletter-optin-box' ),
				'remote_type'     => 'text',
			),

			array(
				'remote_id'       => 'email',
				'remote_label'    => __( 'Email', 'newsletter-optin-box' ),
				'remote_type'     => 'email',
				'remote_required' => true,
			),

			array(
				'remote_id'       => 'GDPR_consent',
				'remote_label'    => __( 'GDPR Consent', 'newsletter-optin-box' ),
				'remote_type'     => 'acceptance',
			),

		);

		foreach ( get_special_noptin_form_fields() as $name => $field ) {

			$id    = esc_attr( sanitize_html_class( $name ) );
			$type  = esc_attr( $field[0] );
			$label = wp_kses_post( $field[1] );

			if ( $type === 'text' || $type === 'checkbox' || $type === 'textarea' || $type === 'hidden' ) {

				$map_fields[] = array(
					'remote_id'    => $id,
					'remote_label' => $label,
					'remote_type'  => $type,
				);

			}

		}

		// Map Fields.
		$widget->add_control(
			'noptin_fields_map',
			array(
				'label'     => __( 'Field Mapping', 'newsletter-optin-box' ),
				'type'      => ElementorPro\Modules\Forms\Controls\Fields_Map::CONTROL_TYPE,
				'separator' => 'before',
				'fields'    => array(

					array(
						'name' => 'remote_id',
						'type' => Elementor\Controls_Manager::HIDDEN,
					),

					array(
						'name' => 'local_id',
						'type' => Elementor\Controls_Manager::SELECT,
					),

				),

				'default' => apply_filters( 'noptin_elementor_map_fields', $map_fields ),
			)
		);

		do_action( 'noptin_elementor_forms_integration_settings', $widget, $this );

		$widget->end_controls_section();

	}


Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation