<?php

require_once get_template_directory() . '/functions/tgm-plugin-activation/class-tgm-plugin-activation.php';

add_action( 'tgmpa_register', 'register_required_plugins' );

function register_required_plugins(){
	$plugins = [

		// This is an example of how to include a plugin bundled with a theme.
		/*
		[
			'name'               => 'TGM Example Plugin',
			'slug'               => 'tgm-example-plugin',
			'source'             => get_template_directory() . '/lib/plugins/tgm-example-plugin.zip',
			'required'           => true,
			'version'            => '',
			'force_activation'   => false,
			'force_deactivation' => false,
			'external_url'       => '',
			'is_callable'        => '',
		],
		*/

		[
			'name'               => 'Advanced Custom Fields PRO',
			'slug'               => 'advanced-custom-fields-pro',
			'source'             => get_template_directory() . '/functions/tgm-plugin-activation/plugins/advanced-custom-fields-pro-6.3.9.zip',
			'required'           => true,
			'version'            => '',
			'force_activation'   => false,
			'force_deactivation' => false,
			'external_url'       => '',
			'is_callable'        => '',
		],
		[
			'name'               => 'Elementor',
			'slug'               => 'elementor',
			'source'             => get_template_directory() . '/functions/tgm-plugin-activation/plugins/elementor.3.24.7.zip',
			'required'           => true,
			'version'            => '',
			'force_activation'   => false,
			'force_deactivation' => false,
			'external_url'       => '',
			'is_callable'        => '',
		],
		[
			'name'               => 'Elementor (Pro)',
			'slug'               => 'elementor-pro',
			'source'             => get_template_directory() . '/functions/tgm-plugin-activation/plugins/elementor-pro-3.24.4.zip',
			'required'           => true,
			'version'            => '',
			'force_activation'   => false,
			'force_deactivation' => false,
			'external_url'       => '',
			'is_callable'        => '',
		],
		[
			'name'               => 'Query Monitor',
			'slug'               => 'query-monitor',
			'source'             => get_template_directory() . '/functions/tgm-plugin-activation/plugins/query-monitor.3.16.4.zip',
			'required'           => false,
			'force_activation'   => false,
			'force_deactivation' => false,
		],


		// This is an example of how to include a plugin from wordpress.
		/*
		[
			'name'      => 'Advanced Custom Fields',
			'slug'      => 'advanced-custom-fields',
			'required'  => true,
		],
		*/

		// This is an example of the use of 'is_callable' functionality. A user could - for instance -
		// have WPSEO installed *or* WPSEO Premium. The slug would in that last case be different, i.e.
		// 'wordpress-seo-premium'.
		// By setting 'is_callable' to either a function from that plugin or a class method
		// `[ 'class', 'method' )` similar to how you hook in to actions and filters, TGMPA can still
		// recognize the plugin as being installed.
		/*
		[
			'name'        => 'WordPress SEO by Yoast',
			'slug'        => 'wordpress-seo',
			'is_callable' => 'wpseo_init',
		],
		*/
	];


	$config = [
		'id'           => 'theme_plugins',
		'default_path' => '',
		'menu'         => 'tgmpa-install-plugins',
		'parent_slug'  => 'themes.php',
		'capability'   => 'edit_theme_options',
		'has_notices'  => true,
		'dismissable'  => true,
		'dismiss_msg'  => '',
		'is_automatic' => false,
		'message'      => '',
	];

	tgmpa( $plugins, $config );
}
