<?php
define( 'CCF_PATH', plugin_dir_path( __FILE__ ) );
define( 'CCF_URL', plugin_dir_url( __FILE__ ) );
define( 'CCF_VER', '2.1.4' );
define( 'CCF_CORE', __FILE__ );
add_action( 'init', 'cf_custom_fields_init' );
function cf_custom_fields_init() {
if( class_exists( 'Caldera_Forms_Fields' ) ) {
include_once( CCF_PATH . '/includes/metabox.php' );
include_once( CCF_PATH . '/includes/to-post-type.php' );
}else{
add_action( 'admin_notices', 'cf_custom_fields_need_cf_update_notice' );
}
}
function cf_custom_fields_need_cf_update_notice() {
?>
<div class="notice notice-error">
<p>
<?php esc_html_e( 'Caldera Forms Custom Fields Requires Caldera Forms 1.5 or later. Please update Caldera Forms or disable this add-on.', 'caldera-form-metabox' ); ?>
</p>
</div>
<?php
}
function cf_custom_fields_get_forms() {
_deprecated_function( __FUNCTION__, '2.1.3', 'Caldera_Forms_Forms::get_forms( true )' );
if ( class_exists( 'Caldera_Forms_Forms' ) ) {
$forms = Caldera_Forms_Forms::get_forms( true );
} else {
$forms = Caldera_Forms::get_forms();
}
return $forms;
}
function cf_custom_fields_get_form( $id_name ) {
_deprecated_function( __FUNCTION__, '2.1.3', 'Caldera_Forms_Forms::get_form()' );
$form = Caldera_Forms_Forms::get_form( $id_name );
if( isset( $form[ 'ID' ] ) && ! isset( $form[ 'id' ] ) ) {
$form[ 'id' ] = $form[ 'ID' ];
}
return $form;
}