<?php
/**
 * Template File
 * This file is used to create the overlay displayed above the Template editor on the Content Template edit page, when
 * the Divi Builder is selected.
 *
 * @since 2.5.0
 */

$ct_id = (int) wpv_getget( 'ct_id', 0 );
$medium_allowed_frontend_templates = $this->medium->get_frontend_templates();
?>

<div id="anchor-usage-section" class="toolset-user-editors-divi-backend js-toolset-user-editors-divi-backend">
    <h3><?php echo sprintf( __( '%1$s', 'wpv-views' ), $this->editor->get_name() ); ?></h3>
    <?php
    if ( count( $medium_allowed_frontend_templates ) == 1 ) {
        $template = array_pop( $medium_allowed_frontend_templates );
	?>
    <p>
		<?php
		echo sprintf(
			__( 'This Content Template is used in %1$s, and was created using Divi Builder.', 'wpv-views' ),
			'<strong>' . $template['form-option-label'] . '</strong>'
		);
		?>
    </p>
	<?php
    } else {
    ?>
    <p>
		<?php _e( 'You created this template using Divi Builder.', 'wpv-views' ); ?>
    </p>
    <?php
    }
    ?>
    <div>
        <a href="<?php echo admin_url( 'post.php?post=' . $ct_id . '&action=edit' ); ?>" class="button button-primary button-large">
            <?php _e( 'Edit with Divi Builder', 'wpv-views' ); ?>
        </a>
    </div>
</div>