<?php
/**
 * The template to display entry share links.
 *
 * This template can be overridden by copying it to
 * your-child-theme/views/entry/single/share-links.php.
 *
 * @param array $args
 *
 * @package MadeByAura\Prime
 * @author  MadeByAura.com
 */

namespace MadeByAura\Prime;

use MadeByAura\Prime\Helpers\Markup;
use MadeByAura\Prime\Helpers\ShareLinks;

defined( 'ABSPATH' ) || die();

// Set variables.
$sites = ShareLinks::get_sites();
$links = ShareLinks::get_links( get_the_ID() );
?>

<div class="aura-share-links">
	<?php foreach ( $links as $id => $url ) : ?>
		<?php
			$classes   = [];
			$classes[] = 'aura-share-links__item';
			$classes[] = 'aura-share-links__item--' . $id;
		?>

		<a
			class="<?php Markup::echo_classes( $classes ); ?>"
			href="<?php echo esc_url( $url ); ?>"
			target="_blank"
			rel="noopener"
		>
			<?php echo esc_html( $sites[ $id ] ); ?>
		</a>
	<?php endforeach; ?>
</div>
