<?php

namespace Elementor_Pay_Addons\Form;

if (!defined('ABSPATH')) {
	exit();
}

// Exit if accessed directly

trait Form_Controls_Trait {
  public function add_payment_section_controls() {
    $this->start_controls_section(
			'epa_section_payment_action',
			[
				'label' => esc_html__( 'Payment Action', 'pay-addons-for-elementor' ),
			]
    );

    // Form actions
		$actions = Form_Module::instance()->actions_registrar->get();
    $actions_options = [];

		foreach ( $actions as $action ) {
			$actions_options[ $action->get_name() ] = $action->get_label();
		}

    $this->add_control(
      'submit_actions',
				[
					'label' => esc_html__('Payment Action', 'pay-addons-for-elementor'),
					'type' => \Elementor\Controls_Manager::SELECT,
					'description' => __('Choose the right payment type for the form. This will determine how the payment fields are displayed.', 'pay-addons-for-elementor'),
					'label_block' => false,
					'default' => '',
					'options' => $actions_options,
					'frontend_available' => true,
				]
    );

    $this->end_controls_section();
		
		foreach ( $actions as $action ) {
			$action->register_settings_section( $this );
		}
  }
}