<?php
/**
 * User Avatar Block - Template
 * 
 * @package OrokuBlocks
 * @author OrokuBlocks (https://orokublocks.com/)
 * 
 * @since 1.0.0
 * 
 * @param array $args {
 *   @type string $style                            Block style. Accepted values: 'row', 'column'. Default: 'row'.
 *   @type string $avatar_url                       User avatar URL.
 *   @type bool   $user_avatar_gradient             True to use gradient, false otherwise.
 *   @type bool   $verified_user                    True if user is verified, false otherwise.
 *   @type string $user_text                        User text.
 *   @type string $user_name                        User name.
 * }
 */

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

$defaults = [
  'style' => 'row'
];

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

?>
<div class="orokublocks-card__item orokublocks-card__item--divided orokublocks-card__item--gap--mini orokublocks-card__item--align--center<?php if ( $options['style'] === 'column' ) : ?> orokublocks-card__item--direction--vertical<?php endif; ?>">
<?php 

  if ( $options['avatar_url'] !== '' ) {
    $user_avatar_options = [
      'avatar_url'    => $options['avatar_url'],
      'verified_user' => $options['verified_user']
    ];

    if ( $options['user_avatar_gradient'] ) {
      $user_avatar_options['style'] = [ 'gradient' ];
    }
  
    /**
     * User Avatar
     */
    orokublocks()->requireTemplate( 'includes/template/user-avatar', $user_avatar_options );
  }

?>
  <p class="orokublocks-card__text">
    <?php echo esc_html( $options['user_text'] ); ?>
    <span class="orokublocks-card__text--style--bold"><?php echo esc_html( $options['user_name'] ); ?></span>
  </p>
</div>