<?php

/**
 * Provide a admin-facing view for the Product Builder Fields form of the plugin
 *
 * @link       https://wpconfiguratorbuilder.com
 * @since      1.0.0
 *
 * @package    wcb-configurator-builder
 * @subpackage wcb-configurator-builder/includes
 */

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

use Carbon_Fields\Block;
use Carbon_Fields\Field;

$builder_input_fields = array(
	Field::make( 'separator', 'wpcb_input_toggler', __( 'Input', 'wcb-configurator-builder' ) )
		->set_classes('accordeon'),
	Field::make( 'select', 'wpcb_field', __( 'Field', 'wcb-configurator-builder' ) )
		->set_help_text( __( 'Select input field', 'wcb-configurator-builder' ) )
		->add_options( 'wpcb_get_configurator_inputs' ),
	Field::make( 'checkbox', 'wpcb_field_hidden', __( 'Make field hidden', 'wcb-configurator-builder' ) )
		->set_default_value(false),
	Field::make( 'checkbox', 'wpcb_field_collapsible', __( 'Make field collapsible', 'wcb-configurator-builder' ) )
		->set_default_value(false),
	Field::make( 'select', 'wpcb_field_collapsible_state', __( 'Collapsible state', 'wcb-configurator-builder' ) )
		->set_options( array(
			'yes' => __( 'Collapsed', 'wcb-configurator-builder' ),
			'no' => __( 'Open', 'wcb-configurator-builder' ),
		))
		->set_conditional_logic( array( array(
			'field' => 'wpcb_field_collapsible',
			'value' => true,
		))),
);

$builder_input_fields = apply_filters( 'wpcb_builder_input_fields', $builder_input_fields );

Block::make( __( 'WCB Input', 'wcb-configurator-builder' ) )
	->add_fields( $builder_input_fields )
	->set_description( __( 'Displays an input in the configuration form', 'wcb-configurator-builder' ) )
	->set_keywords(['wcb', 'input'])
	->set_category( 'wpcb-general', __( 'General', 'wcb-configurator-builder' ) )
	->set_icon( 'button' )
	->set_mode( 'edit' )
	->set_render_callback( function ( $fields, $attributes, $inner_blocks ) {
		
		// include block partial

	});