forked from TangibleInc/template-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
63 lines (49 loc) · 1.44 KB
/
index.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* Glider - Fullscreen gallery slider
*/
namespace tangible\template_system\glider;
use tangible\template_system;
use tangible\template_system\glider;
function register() {
$url = template_system::$state->url . '/modules/glider';
$version = template_system::$state->version;
wp_register_script(
'tangible-glider',
"{$url}/build/glider.min.js",
[ 'jquery' ],
$version,
true
);
wp_register_style(
'tangible-glider',
"{$url}/build/glider.min.css",
[],
$version,
);
}
function enqueue() {
wp_enqueue_script('tangible-glider');
wp_enqueue_style('tangible-glider');
}
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\\register', 0 );
add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\\register', 0 );
$html->add_open_tag('Glider', function( $atts, $nodes ) use ( $html ) {
glider\enqueue();
// <Glider enqueue />
if (in_array( 'enqueue', $atts['keys'] )) return;
return $html->render_tag('div', array_merge($atts, [
'class' => 'tangible-glider tangible-dynamic-module'
. ( isset( $atts['class'] ) ? ' ' . $atts['class'] : '' )
,
/**
* Support for page builders with dynamic HTML
* @see /module-loader in Template module
*/
'data-tangible-dynamic-module' => 'glider',
]), $nodes);
});
$html->add_open_tag('Glide', function( $atts, $nodes ) use ( $html ) {
// TODO: Image linked to thumbnail
return $html->render_tag( 'a', $atts, $nodes );
});