<?php
/**
 * User Avatar - Template
 * 
 * @package OrokuBlocks
 * @author OrokuBlocks (https://orokublocks.com/)
 * 
 * @since 1.0.0
 * 
 * @param array $args {
 *   @type array  $style                          Style classes. Accepted values: 'gradient'.
 *   @type string $avatar_url                     User avatar URL.
 *   @type bool   $verified_user                  True if user is verified, false otherwise.
 * }
 */

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

$defaults = [];

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

$wrapper_classes = [
  'orokublocks-user-avatar'
];

if ( array_key_exists( 'style', $options ) ) {
  foreach ( $options['style'] as $offset ) {
    $wrapper_classes[] = 'orokublocks-user-avatar--style--' . $offset;
  }
}

?>
<div class="<?php echo esc_attr( implode( ' ', $wrapper_classes ) ); ?>">
  <img class="orokublocks-user-avatar__image" src="<?php echo esc_url( $options['avatar_url'] ); ?>" alt="">
<?php

  if ( $options['verified_user'] ) {
    /**
     * Verified Tag
     */
    orokublocks()->requireTemplate( 'includes/template/verified-tag' );
  }

?>
</div>