<?php

/**
 * @since 1.0
 * @class FLWooCartButtonModule
 */
class FLWooCartButtonModule extends FLBuilderModule {

	/**
	 * @since 1.0
	 * @return void
	 */
	public function __construct() {
		parent::__construct(array(
			'name'          	=> __( 'Add to Cart Button', 'fl-theme-builder' ),
			'description'   	=> __( 'Displays the cart button for the current product.', 'fl-theme-builder' ),
			'group'       		=> __( 'Themer Modules', 'fl-theme-builder' ),
			'category'      	=> __( 'WooCommerce', 'fl-theme-builder' ),
			'partial_refresh'	=> true,
			'dir'               => FL_THEME_BUILDER_DIR . 'extensions/woocommerce/modules/fl-woo-cart-button/',
			'url'               => FL_THEME_BUILDER_URL . 'extensions/woocommerce/modules/fl-woo-cart-button/',
			'enabled'           => FLThemeBuilderLayoutData::current_post_is( 'singular' ),
		));
	}
}

FLBuilder::register_module( 'FLWooCartButtonModule', array(
	'general'       => array(
		'title'         => __( 'Style', 'fl-theme-builder' ),
		'sections'      => array(
			'general'         => array(
				'title'         => '',
				'fields'        => array(
					'bg_color'      => array(
						'type'          => 'color',
						'label'         => __( 'Background Color', 'fl-theme-builder' ),
						'show_reset'    => true,
					),
					'text_color'    => array(
						'type'          => 'color',
						'label'         => __( 'Text Color', 'fl-theme-builder' ),
						'show_reset'    => true,
						'preview'       => array(
							'type'          => 'css',
							'selector'      => '.fl-module-content button',
							'property'      => 'color',
						),
					),
				),
			),
		),
	),
) );
