<?php

add_filter( 'vc_edit_form_fields_attributes_vc_single_image', 'vc_single_image_convert_old_link_to_new' );

/**
 * Backward compatibility
 *
 * @since 4.6
 **/
function vc_single_image_convert_old_link_to_new( $atts ) {
	if ( empty( $atts['onclick'] ) && isset( $atts['img_link_large'] ) && 'yes' === $atts['img_link_large'] ) {
		$atts['onclick'] = 'img_link_large';
		unset( $atts['img_link_large'] );
	} else if ( empty( $atts['onclick'] ) && ( ! isset( $atts['img_link_large'] ) || 'yes' !== $atts['img_link_large'] ) ) {
		unset( $atts['img_link_large'] );
	}

	return $atts;
}