| 1 |
<?php |
| 2 |
/** |
| 3 |
* Add-Ons categories. |
| 4 |
* |
| 5 |
* @package Formidable |
| 6 |
* |
| 7 |
* @var array<string, array{name: string, count: int}> $categories Categories keyed by slug. |
| 8 |
*/ |
| 9 |
|
| 10 |
if ( ! defined( 'ABSPATH' ) ) { |
| 11 |
die( 'You are not allowed to call this page directly.' ); |
| 12 |
} |
| 13 |
?> |
| 14 |
<ul class="frm-page-skeleton-categories frm-flex-col frm-gap-xs" aria-label="<?php esc_attr_e( 'Categories', 'formidable' ); ?>"> |
| 15 |
<?php foreach ( $categories as $category_slug => $category_data ) { ?> |
| 16 |
<?php |
| 17 |
$classes = 'frm-page-skeleton-cat frm-flex-box frm-justify-between frm-font-medium'; |
| 18 |
$aria_label = sprintf( |
| 19 |
// translators: %1$s: category name, %2$d: number of items in the category |
| 20 |
esc_html__( '%1$s category, %2$d items', 'formidable' ), |
| 21 |
esc_html( $category_data['name'] ), |
| 22 |
esc_html( $category_data['count'] ) |
| 23 |
); |
| 24 |
|
| 25 |
if ( 'all-items' === $category_slug || 'basic' === $category_slug ) { |
| 26 |
echo '<li class="frm-page-skeleton-divider frm-mt-xs frm-mb-xs"></li>'; |
| 27 |
} |
| 28 |
|
| 29 |
if ( 'all-items' === $category_slug ) { |
| 30 |
$classes .= ' frm-current'; |
| 31 |
} |
| 32 |
?> |
| 33 |
|
| 34 |
<li class="<?php echo esc_attr( $classes ); ?>" data-category="<?php echo esc_attr( $category_slug ); ?>" tabindex="0" aria-label="<?php echo esc_attr( $aria_label ); ?>"> |
| 35 |
<span class="frm-page-skeleton-cat-text"><?php echo esc_html( $category_data['name'] ); ?></span> |
| 36 |
<span class="frm-page-skeleton-cat-count"><?php echo esc_html( $category_data['count'] ); ?></span> |
| 37 |
</li> |
| 38 |
<?php |
| 39 |
}//end foreach |
| 40 |
?> |
| 41 |
</ul> |
| 42 |
|