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
|
<?php if ( ! defined( 'ABSPATH' ) ) { exit; } if( ! class_exists( 'Penci_Gutenberg_Button' ) ): class Penci_Gutenberg_Button {
public function render( $attributes, $content ) { $param = ' wpblock="true"'; if( $attributes ){ foreach ( (array)$attributes as $k => $v ){ if( $v && 'content' != $k ){ $param .= ' ' . $k . '="' . $v . '"'; } } }
return do_shortcode( '[penci_button' . $param . ']' . ( $attributes['content'] ? $attributes['content'] : '' ) . '[/penci_button]' ); } public function attributes() { $options = array( 'content' => array( 'type' => 'string', 'default' => esc_html__( 'Add text...', 'penci-framework' ), ), 'link' => array( 'type' => 'string', 'source' => 'attribute', 'selector' => 'a', 'attribute' => 'href', 'default' => '#', ), 'size' => array( 'type' => 'string', 'default' => '' ), 'icon' => array( 'type' => 'string', 'default' => 'fa fa-address-book' ), 'icon_position' => array( 'type' => 'string', 'default' => 'left' ), 'align' => array( 'type' => 'string', 'default' => '' ), 'full' => array( 'type' => 'boolean', 'default' => false, ), 'target' => array( 'type' => 'string', ), 'nofollow' => array( 'type' => 'boolean', 'default' => false, ), 'id' => array( 'type' => 'string', ), 'class' => array( 'type' => 'string', 'default' => '' ), 'margin_bottom' => array( 'type' => 'string', ), 'text_color' => array( 'type' => 'string', ), 'background' => array( 'type' => 'string', ), 'text_hover_color' => array( 'type' => 'string', ), 'hover_bgcolor' => array( 'type' => 'string', ), );
return $options; } } endif;
|