-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass.front-end.php
59 lines (51 loc) · 1.36 KB
/
class.front-end.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
<?php
/**
*
* This file deals with adding our custom component to Aesop Story Engine frontend interface
*
* @package Chat for Aesop Story Engine
*/
/**
* Frontend component definition
*/
class ChatComponentFront {
/**
* Create the components used by Lasso.
*/
function __construct() {
add_action( 'lasso_toolbar_components', array( $this, 'components_list' ) );
add_filter( 'lasso_components', array( $this, 'components_available' ), 11, 1 );
}
/**
*
* Add our component to the drop-up list of components
*
* Note: data-type must match the component slug listed above
*/
function components_list() {
?><li data-type="chat" title="Chat"></li><?php
}
/**
*
* First let's wipe out the existing components and replace with our own
*
* @param array $existing Variable passed on to array_merge().
*/
function components_available( $existing ) {
$components = array(
'chat' => array(
'name' => 'Image',
'content' => self::my_callback(),
),
);
return array_merge( $existing, $components );
}
/**
*
* Create a docs image component ( Dynamic (shortcode) Based )
*/
function my_callback() {
return do_shortcode( '[aesop_chat]' ); // Note how this matches above. 'aesop' is automatically prefixed.
}
}
new ChatComponentFront;