<?php
/**
 * Symbol Button - Template
 * 
 * @package OrokuBlocks
 * @author OrokuBlocks (https://orokublocks.com/)
 * 
 * @since 1.0.0
 * 
 * @param array $args {
 *   @type string $href                       Button href.
 *   @type string $position                   Button position.
 *   @type string $icon                       Button icon.
 * }
 */

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

$defaults = [
  'href'      => '#',
  'position'  => [],
  'icon'      => ''
];

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

$wrapper_classes = [
  'orokublocks-symbol-button'
];

if ( count( $options['position'] ) > 0 ) {
  $wrapper_classes[] = 'orokublocks-symbol-button--floaty';

  foreach ( $options['position'] as $position ) {
    $wrapper_classes[] = 'orokublocks-symbol-button--position--' . $position;
  }
}

?>
<a class="<?php echo esc_attr( implode( ' ', $wrapper_classes ) ); ?>" href="<?php echo esc_url( $options['href'] ); ?>">
<?php

  /**
   * SVG
   */
  orokublocks()->requireTemplate(
    'includes/template/svg',
    [
      'additional_wrapper_classes'  => 'orokublocks-symbol-button__icon',
      'icon'                        => $options['icon']
    ]
  );

?>
</a>