-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclass.front-end.php
More file actions
74 lines (57 loc) · 1.33 KB
/
class.front-end.php
File metadata and controls
74 lines (57 loc) · 1.33 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
class myCustomComponentFront {
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="test" title="Sample Title"></li><?php
}
/**
*
* First let's wipe out the existing components and replae with our own
*
*
*/
function components_available($existing){
$components = array(
'test' => array(
'name' => 'Image',
'content' => self::my_callback()
)
);
return array_merge($existing, $components);
}
/**
*
* Create a docs image component ( HTML Based )
* Note: we use aesop-component class so that the user can has controls
*
*/
/*
function my_callback(){
ob_start();
?>
<div class="cgcm-image-component aesop-component" data-component-type="test" >
<img src="http://placekitten.com/800/540">
</div>
<?php
return ob_get_clean();
}
*/
/**
*
* Create a docs image component ( Dynamic (shortcode) Based )
*
*/
function my_callback(){
return do_shortcode( '[aesop_test]' ); // note how this matches L:32 above. 'aesop' is automatically prefixed
}
}
new myCustomComponentFront;