';
} else {
echo '
";
}
function acf_vc_integrator_showAdminMessages() {
if ( !class_exists('Vc_Manager') and !is_plugin_active( 'advanced-custom-fields/acf.php' ) AND !is_plugin_active( 'advanced-custom-fields-pro/acf.php' )) {
acf_vc_integrator_showMessage("ACF-VC Integrator require both WPBakery Page Builder and Advanced Custom Fields plugins installed and activated.", "error");
} elseif ( !class_exists('Vc_Manager') ) {
acf_vc_integrator_showMessage("ACF-VC Integrator require WPBakery Page Builder plugin installed and activated.", "error");
} elseif ( !is_plugin_active( 'advanced-custom-fields/acf.php' ) AND !is_plugin_active( 'advanced-custom-fields-pro/acf.php' ) ) {
acf_vc_integrator_showMessage("ACF-VC Integrator require Advanced Custom Fields or Advanced Custom Fields Pro plugin installed and activated.", "error");
}
if(is_plugin_active( 'advanced-custom-fields-pro/acf.php' )) {
$screen = get_current_screen();
if( $screen->parent_base === "acf-vc-integrator" ) {
// acf_vc_integrator_showMessage("ACF-VC Integrator version 1.2 supports the Repeater field in ACF-Pro, as well as fields also found in ACF.", "info");
} elseif($screen->parent_base === "plugins") {
// acf_vc_integrator_showMessage("ACF-VC Integrator version 1.2 supports the Repeater field in ACF-Pro, as well as fields also found in ACF.", "info", "is-dismissible");
}
}
}
add_action('admin_notices', 'acf_vc_integrator_showAdminMessages');
}
//Check for ACF and VC plugins
add_action('admin_init', 'acf_vc_integrator_check_for_dependancy');
//Get acf OR acf pro version number
function get_acf_version_number() {
if ( defined('ACF_VERSION') ) {
return ACF_VERSION;
} else {
return NULL;
}
}
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'acfvc_add_action_links' );
function acfvc_add_action_links ( $links ) {
$settings_link = '
' . __( 'Settings' ) . '';
array_unshift( $links, $settings_link );
return $links;
}
function is_acf_repeater_active() {
if( is_plugin_active( 'acf-repeater/acf-repeater.php' ) AND !is_plugin_active( 'advanced-custom-fields-pro/acf.php' ) ) {
return true;
} else {
return false;
}
}
function acf_vc_load_custom_wp_admin_style($hook) {
if($hook != 'settings_page_acf-vc-integrator') {
return;
}
wp_enqueue_style( 'acf_vc_admin_style', plugins_url('css/admin-style.css', __FILE__) );
}
add_action( 'admin_enqueue_scripts', 'acf_vc_load_custom_wp_admin_style' );
function acf_vc_integrator_admin_actions() {
add_options_page("ACF-VC Integrator", "ACF-VC Integrator", "manage_options", "acf-vc-integrator", "acf_vc_integrator_admin");
}
add_action('admin_menu', 'acf_vc_integrator_admin_actions');
require_once dirname(__FILE__).'/admin/acf-vc-integrator-admin.php';
/*include wpbakery element*/
// include_once 'inc/wpbakery/wpbakery_element.php';
add_action( 'vc_before_init', 'acf_vc_integrator_elem' );
function acf_vc_integrator_elem() {
if ( class_exists('Vc_Manager') ) {
function acfvc_wpbakery_hidden_field_name_callback( $settings, $value ) {
return '
';
}
function vc_edit_form_fields_render_field_acfvc_wpbakery_hidden_field_name_before( $output ) {
return '
';
}
function vc_edit_form_fields_render_field_acfvc_wpbakery_hidden_field_name_after( $output ) {
return '
';
}
vc_add_shortcode_param( 'acfvc_wpbakery_hidden_field_name', 'acfvc_wpbakery_hidden_field_name_callback', ACFVC_URL.'inc/wpbakery/acfvc_hidden_field.js' );
add_filter( 'vc_edit_form_fields_render_field_acfvc_wpbakery_hidden_field_name_before', 'vc_edit_form_fields_render_field_acfvc_wpbakery_hidden_field_name_before' );
add_filter( 'vc_edit_form_fields_render_field_acfvc_wpbakery_hidden_field_name_after', 'vc_edit_form_fields_render_field_acfvc_wpbakery_hidden_field_name_after' );
require_once dirname(__FILE__).'/inc/wpbakery/wpbakery_element_shortcode.php';
vc_lean_map('acf_vc_integrator', null, dirname(__FILE__).'/inc/wpbakery/wpbakery_element.php');
add_filter( 'vc_grid_item_shortcodes','mapacfvcGridItemShortcodes',10,1);
function mapacfvcGridItemShortcodes( array $shortcodes ) {
require_once dirname(__FILE__).'/inc/wpbakery/wpbakery_grid_element_shortcode.php';
require_once dirname(__FILE__).'/inc/wpbakery/wpbakery_grid_element_attributes.php';
$wc_shortcodes = include dirname(__FILE__).'/inc/wpbakery/wpbakery_grid_element.php';
return $shortcodes + $wc_shortcodes;
}
}
}
?>