-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.php
36 lines (32 loc) · 1.15 KB
/
template.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* Template for expandable list module
*
* $this is an instance of the Expandable_List object.
*
* Available properties:
* $this->list_items (array) Items with title and content for each item in the list.
* $this->counter (int) Module index in flexible layout.
*
* @package Hogan
*/
declare( strict_types = 1 );
namespace Dekode\Hogan;
if ( ! defined( 'ABSPATH' ) || ! ( $this instanceof Expandable_List ) ) {
return; // Exit if accessed directly.
}
foreach ( $this->list_items as $key => $item ) :
$list_item_classes = array_merge(
[ 'hogan-expandable-list-item' ],
apply_filters( 'hogan/module/expandable_list/list_item_classes', [], $this )
);
$list_item_classes = trim( implode( ' ', array_filter( $list_item_classes ) ) );
$list_item_id = 'panel-' . $this->counter . '-' . $key;
?>
<div class="<?php echo esc_attr( $list_item_classes ); ?>">
<a href="#<?php echo esc_attr( $list_item_id ); ?>"><?php echo esc_html( $item['item_title'] ); ?><span></span></a>
<div id="<?php echo esc_attr( $list_item_id ); ?>" aria-expanded="false">
<?php echo wp_kses_post( $item['item_content'] ); ?>
</div>
</div>
<?php endforeach; ?>