-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclass.settings.php
More file actions
101 lines (93 loc) · 2.94 KB
/
class.settings.php
File metadata and controls
101 lines (93 loc) · 2.94 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
*
* This class is responsible for creating custom options used by both Aesop Story Engine and Lasso
*
*/
class myCustomComponentSettings {
function __construct(){
// if you arent using Lasso then this filter isnt needed
add_filter('lasso_custom_options', array($this,'options'));
// if you arent using aesop story engine then this filter isnt needed
add_filter('aesop_avail_components', array($this, 'options') );
}
/**
*
* This adds our options into the generator for both Lasso and Aesop Story Engine
*
*/
function options($shortcodes) {
$custom = array(
'test' => array(
'name' => 'Test Component', // name of the component
'type' => 'single', // single - wrap
'atts' => array(
'alpha' => array(
'type' => 'text_small', // a small text field
'default' => '',
'desc' => 'Small Text Field',
'prefix' => 'px', // optional prefix that you can pass to aid in correct value inputs by user
'tip' => 'Here is a tip for this option.'
),
'beta' => array(
'type' => 'text', // a large text field
'default' => 'left',
'desc' => 'Large Text Field',
'tip' => 'Here is a tip for this option.'
),
'charlie' => array(
'type' => 'text_area', // a textarea
'default' => 'left',
'desc' => 'Textarea',
'tip' => 'Here is a tip for this option.'
),
'delta' => array(
'type' => 'color',
'default' => '#0077aa',
'desc' => 'Color Option Type',
'tip' => 'Tip here.'
),
'echo' => array(
'type' => 'select', // a select dropdown
'values' => array(
array(
'value' => 'optionvalue',
'name' => 'Option Name'
),
array(
'value' => 'anotheroption',
'name' => 'Option Name'
)
),
'default' => '',
'desc' => 'A dropdown option.',
'tip' => 'Tip here'
),
'foxtrot' => array(
'type' => 'select',
'values' => function_exists('aesop_option_counter') ? aesop_option_counter(10) : false, // pass the max number of items to produce
'default' => '2',
'desc' => 'Counter Option Type',
'tip' => 'Tip here.'
),
'golf' => array(
'type' => 'select',
'values' => function_exists('aesop_option_get_categories') ? aesop_option_get_categories('post') : false, // pass the type - default is post
'default' => '',
'desc' => 'Categories Option Type',
'tip' => 'Tip here.'
),
'hotel' => array(
'type' => 'select',
'values' => function_exists('aesop_option_get_posts') ? aesop_option_get_posts('post') : false, // pass the type - default is post
'default' => '',
'desc' => 'Post Option Type',
'tip' => 'Tip here.'
)
)
)
);
return array_merge( $shortcodes, $custom );
}
}
new myCustomComponentSettings;