<?php
/**
 * Card Features - Template
 * 
 * @package OrokuBlocks
 * @author OrokuBlocks (https://orokublocks.com/)
 * 
 * @since 1.0.0
 * 
 * @param array $args {
 *   @type array  $features                       Feature data.
 *   @type string $style                          Card features style, one of: 'vertical', 'horizontal'. Default: 'vertical'.
 *   @type string $feature_list_style             Feature list style, one of: 'row'.
 * }
 */

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

$defaults = [
  'features'            => [],
  'style'               => 'vertical',
  'feature_list_style'  => ''
];

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

?>
<?php if ( count( $options['features'] ) > 0 ) : ?>
  <div class="orokublocks-card__item orokublocks-card__item--divided<?php if ( $options['style'] === 'vertical' ) : ?> orokublocks-card__item--gap--medium orokublocks-card__item--direction--vertical<?php else: ?> orokublocks-card__item--divided--width--full orokublocks-card__item--gap--big orokublocks-card__item--justify--space--between orokublocks-card__item--direction--vertical--tablet<?php endif; ?>">
  <?php foreach ( $options['features'] as $feature ) : ?>
    <div class="orokublocks-card__item">
    <?php if ( $feature['title'] !== '' ) : ?>
      <p class="orokublocks-card__text orokublocks-card__text--size--small"><?php echo esc_html( $feature['title'] ); ?></p>
    <?php endif; ?>
    <?php

      /**
       * Feature List
       */
      orokublocks()->requireTemplate(
        'includes/template/feature-list',
        [
          'style'             => $options['feature_list_style'],
          'icon'              => $feature['icon'],
          'status_tag_style'  => $feature['status_tag_style'],
          'features'          => $feature['features'],
          'enabled'           => $feature['enabled']
        ]
      );

    ?>
    </div>
  <?php endforeach; ?>
  </div>
<?php endif; ?>