<?php

if ( ! function_exists( 'calla_elated_include_blog_shortcodes' ) ) {
	function calla_elated_include_blog_shortcodes() {
		include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/blog/shortcodes/blog-list/blog-list.php';
		include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/blog/shortcodes/blog-slider/blog-slider.php';
	}
	
	if ( calla_elated_core_plugin_installed() ) {
		add_action( 'calla_core_action_include_shortcodes_file', 'calla_elated_include_blog_shortcodes' );
	}
}

if ( ! function_exists( 'calla_elated_add_blog_shortcodes' ) ) {
	function calla_elated_add_blog_shortcodes( $shortcodes_class_name ) {
		$shortcodes = array(
			'CallaCore\CPT\Shortcodes\BlogList\BlogList',
			'CallaCore\CPT\Shortcodes\BlogSlider\BlogSlider'
		);
		
		$shortcodes_class_name = array_merge( $shortcodes_class_name, $shortcodes );
		
		return $shortcodes_class_name;
	}
	
	if ( calla_elated_core_plugin_installed() ) {
		add_filter( 'calla_core_filter_add_vc_shortcode', 'calla_elated_add_blog_shortcodes' );
	}
}

if ( ! function_exists( 'calla_elated_set_blog_list_icon_class_name_for_vc_shortcodes' ) ) {
	/**
	 * Function that set custom icon class name for blog shortcodes to set our icon for Visual Composer shortcodes panel
	 */
	function calla_elated_set_blog_list_icon_class_name_for_vc_shortcodes( $shortcodes_icon_class_array ) {
		$shortcodes_icon_class_array[] = '.icon-wpb-blog-list';
		$shortcodes_icon_class_array[] = '.icon-wpb-blog-slider';
		
		return $shortcodes_icon_class_array;
	}
	
	if ( calla_elated_core_plugin_installed() ) {
		add_filter( 'calla_core_filter_add_vc_shortcodes_custom_icon_class', 'calla_elated_set_blog_list_icon_class_name_for_vc_shortcodes' );
	}
}