MP_Calculator_VC

Class MP_Calculator_VC


Source Source

File: mortgage-platform/Inc/Calculators/MortgageCalculator/Extensions/MP_Calculator_VC.php

class MP_Calculator_VC {


	/**
	 * VC Settings.
	 *
	 * @var array settings
	 *
	 * @since 1.0.0
	 * @array protected
	 */
	protected $settings;



	/**
	 * VC constructor.
	 *
	 * @since 1.0.0
	 * @access public
	 */
	public function __construct() {

		if ( function_exists( 'vc_map' ) ) {  // test for visual composer first
			add_action( 'vc_before_init', array( $this, 'vc_calculator' ) );
		}

		$settings       = new MP_Settings();
		$this->settings = $settings->get_google_fonts();
	}


	/**
	 * Set settings for vc calculator shortcode.
	 *
	 * @since 1.0.0
	 * @access public
	 */
	public function vc_calculator() {
		vc_map(
			array(
				'name'        => MortgagePlatform::$plugin_name,
				'base'        => MortgagePlatform::$shortcode_widget,
				'description' => MortgagePlatform::$plugin_name,
				'category'    => __( 'Mortgage Platform', 'mortgage_platform' ),
				'icon'        => plugins_url( '../../../../assets/img/calculator.svg', __FILE__ ),
				'weight'      => -5,
				'params'      => array(
					array(
						'type'        => 'dropdown',
						'heading'     => __( 'Type Style', 'mortgage_platform' ),
						'param_name'  => 'type_style',
						'description' => __( 'Choose type style of calculator', 'mortgage_platform' ),
						'admin_label' => true,
						'value'       => array(
							__( 'Light Theme', 'mortgage_platform' ) => 'lighttheme',
							__( 'Dark Theme', 'mortgage_platform' )  => 'darktheme',
							__( 'Full Page Theme', 'mortgage_platform' )  => 'fullpage',
						),
					),
					array(
						'type'        => 'colorpicker',
						'heading'     => __( 'Primary Color', 'mortgage_platform' ),
						'param_name'  => 'primary_color',
						'description' => __( 'This sets the primary color for the Calculator', 'mortgage_platform' ),
						'admin_label' => true,
						'value'       => '',
					),
					array(
						'type'        => 'dropdown',
						'heading'     => __( 'Fonts', 'mortgage_platform' ),
						'param_name'  => 'fonts',
						'description' => __( 'Choose the font to use. ', 'mortgage_platform' ),
						'admin_label' => true,
						'value'       => array_flip( $this->settings ),
					),
					array(
						'type'        => 'dropdown',
						'heading'     => __( 'Type inputs', 'mortgage_platform' ),
						'param_name'  => 'type_inputs',
						'description' => __( 'Type inputs', 'mortgage_platform' ),
						'admin_label' => true,
						'value'       => array(
							__( 'Bottom line', 'mortgage_platform' ) => 'bottom_line',
							__( 'Squared', 'mortgage_platform' ) => 'squared_input',
							__( 'Rounded', 'mortgage_platform' ) => 'rounded_input',
						),
					),
					array(
						'type'        => 'dropdown',
						'heading'     => __( 'Rounded Buttons', 'mortgage_platform' ),
						'param_name'  => 'rounded_elements',
						'description' => __( 'Rounded Buttons', 'mortgage_platform' ),
						'value'       => array(
							__( 'Disable', 'mortgage_platform' ) => 0,
							__( 'Enable', 'mortgage_platform' )  => 1,
						),
					),
					array(
						'type'        => 'dropdown',
						'heading'     => __( 'Enable Slider for Input', 'mortgage_platform' ),
						'param_name'  => 'slider_for_input',
						'description' => __( 'Enable Slider for Input', 'mortgage_platform' ),
						'value'       => array(
							__( 'Disable', 'mortgage_platform' ) => 0,
							__( 'Enable', 'mortgage_platform' )  => 1,
						),
					),
					array(
						'type'        => 'dropdown',
						'heading'     => __( 'Type Slider for input', 'mortgage_platform' ),
						'param_name'  => 'type_slyder',
						'description' => __( 'Type Slider for input', 'mortgage_platform' ),
						'value'       => array(
							__( 'Round', 'mortgage_platform' ) => 'round',
							__( 'Oval', 'mortgage_platform' )  => 'oval',
							__( 'Triangle', 'mortgage_platform' ) => 'triangle',
						),
						'dependency'  => array(
							'element' => 'slider_for_input',
							'value'   => array( '1' ),
						),
					),
				),
			)
		);
	}
}

Top ↑

Methods Methods


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.