-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblockparty-tabs.php
More file actions
50 lines (42 loc) · 1.45 KB
/
blockparty-tabs.php
File metadata and controls
50 lines (42 loc) · 1.45 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Plugin Name: Blockparty Tabs
* Description: Accessible Tabs block for WordPress gutenberg.
* Requires at least: 6.2
* Requires PHP: 8.1
* Version: 1.1.2
* Author: Be API Technical team
* Author URI: https://beapi.fr
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: blockparty-tabs
*/
namespace Blockparty\Tabs;
define( 'BLOCKPARTY_TABS_VERSION', '1.1.2' );
define( 'BLOCKPARTY_TABS_URL', plugin_dir_url( __FILE__ ) );
define( 'BLOCKPARTY_TABS_DIR', plugin_dir_path( __FILE__ ) );
define( 'BLOCKPARTY_TABS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
function init(): void {
register_block_type( __DIR__ . '/build/blockparty-tabs' );
register_block_type( __DIR__ . '/build/blockparty-tabs-nav' );
register_block_type( __DIR__ . '/build/blockparty-tabs-nav-item' );
register_block_type( __DIR__ . '/build/blockparty-tabs-panels' );
register_block_type( __DIR__ . '/build/blockparty-tabs-panel-item' );
do_action( 'blockparty_tabs_init' );
}
add_action( 'init', __NAMESPACE__ . '\\init' );
/**
* Allow aria attributes
*
* @param $tags
*
* @return mixed
*/
function allow_attributes( $tags, $context ) {
if ( 'post' === $context ) {
$tags['button']['aria-expanded'] = true;
$tags['div']['tabindex'] = true;
}
return $tags;
}
add_filter( 'wp_kses_allowed_html', __NAMESPACE__ . '\\allow_attributes', 10, 2 );