<?php
/**
 * Point Tag Box - Template
 * 
 * @package OrokuBlocks
 * @author OrokuBlocks (https://orokublocks.com/)
 * 
 * @since 1.0.0
 * 
 * @param array $args {
 *   @type array  $position                       Absolute position offset. Accepted values: 'top', 'top--overlayed', 'center', 'right', 'left'.
 *   @type array  $spacing                        Spacing classes. Accepted values: 'bottom'.
 *   @type string $tag_text                       Tag text.
 *   @type string $tag_image_url                  Tag image URL.
 * }
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
  exit;
}

$defaults = [];

$options = array_merge( $defaults, $args );

$wrapper_classes = [
  'orokublocks-tag-box'
];

if ( array_key_exists( 'position', $options ) ) {
  $wrapper_classes[] = 'orokublocks-tag-box--position--absolute';

  foreach ( $options['position'] as $offset ) {
    $wrapper_classes[] = 'orokublocks-tag-box--position--' . $offset;
  }
}

if ( array_key_exists( 'spacing', $options ) ) {
  foreach ( $options['spacing'] as $direction ) {
    $wrapper_classes[] = 'orokublocks-tag-box--spacing--' . $direction;
  }
}

?>
<div class="<?php echo esc_attr( implode( ' ', $wrapper_classes ) ); ?>">
  <div class="orokublocks-point-award">
    <p class="orokublocks-card__text orokublocks-card__text--size--regular orokublocks-card__text--style--bold"><?php echo esc_html( $options['tag_text'] ); ?></p>

  <?php if ( $options['tag_image_url'] !== '' ) : ?>
    <img class="orokublocks-point-award__image" src="<?php echo esc_url( $options['tag_image_url'] ); ?>" alt="">
  <?php endif; ?>
  </div>
</div>