-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogo-buttons.php
128 lines (108 loc) · 3.67 KB
/
logo-buttons.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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
namespace Elementor;
class LogoButtons extends Widget_Base {
public function get_name() {
return 'logo-buttons';
}
public function get_title() {
return 'Logo Buttons';
}
public function get_icon() {
return 'eicon-logo';
}
public function get_categories() {
return [ 'opp' ];
}
protected function _register_controls() {
$this->start_controls_section(
'section_title',
[
'label' => __( 'Links', 'elementor' ),
]
);
$this->add_control(
'title',
[
'label' => __( 'Title', 'elementor' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'Recommended Links', 'elementor' ),
]
);
$this->add_control(
'content',
[
'label' => __( 'Content', 'elementor' ),
'type' => \Elementor\Controls_Manager::WYSIWYG,
'description' => __( 'Leave blank if not required.', 'elementor' ),
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'logo',
[
'label' => __( 'Logo', 'plugin-name' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'media_types' => ['image', 'svg']
]
);
$repeater->add_control(
'alt',
[
'label' => __( 'Alt Text for Image', 'elementor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => __('Supreme Court Logo', 'elementor'),
]
);
$repeater->add_control(
'url',
[
'label' => __( 'Button URL', 'elementor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => __('https://opp.vic.gov.au/', 'elementor'),
]
);
$this->add_control(
'links',
[
'label' => __('Links', 'elementor'),
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
'label' => __('Label', 'elementor')
],
'title_field' => '{{{ label }}}'
]
);
$this->end_controls_section();
}
protected function render () {
$settings = $this->get_settings_for_display();
$title = $settings['title'];
$content = $settings['content'];
echo '<section class="section section-links links">
<article class="section__content content">
<h2 class="section__title">' . $title . '</h2>
' . $content . '
</article>';
if ( $settings['links'] ) {
echo '<div class="links links--grid">';
foreach ( $settings['links'] as $button ) {
$alt = $button['alt'];
$logo = $button['logo']['url'];
echo '<a href="' . $button['url'] . '" class="btn btn--large btn--secondary btn--logo">
<figure class="btn__logo">
<img src="' . $logo . '" alt="' . $alt . '" />
</figure>
<svg aria-hidden="true" class="chevron" width="19" height="20" viewBox="0 0 19 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.4925 9.39996C12.6039 9.51706 12.6666 9.67592 12.6667 9.84163V10.1583C12.6649 10.3236 12.6025 10.4819 12.4925 10.6L8.42338 14.875C8.34906 14.9538 8.24788 14.9982 8.14234 14.9982C8.0368 14.9982 7.93562 14.9538 7.8613 14.875L7.29922 14.2833C7.22475 14.2065 7.18278 14.1014 7.18278 13.9916C7.18278 13.8819 7.22475 13.7768 7.29922 13.7L10.8221 9.99996L7.29922 6.29996C7.22428 6.22172 7.18213 6.11522 7.18213 6.00412C7.18213 5.89303 7.22428 5.78653 7.29922 5.70829L7.8613 5.12496C7.93562 5.04608 8.0368 5.00171 8.14234 5.00171C8.24788 5.00171 8.34906 5.04608 8.42338 5.12496L12.4925 9.39996Z" fill="white"/>
</svg>
</a>';
}
echo '</div>';
echo '</section>';
}
}
protected function _content_template() {
}
}