PluginProbe
Responsive Menu – Create Mobile-Friendly Menu / 3.0.14
Responsive Menu – Create Mobile-Friendly Menu v3.0.14
4.7.3 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.10 4.1.11 4.1.12 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 All 90 releases
responsive-menu / src / app / Form / FontIconPageList.php

FontIconPageList.php in Responsive Menu – Create Mobile-Friendly Menu 3.0.14, at src/app/Form/FontIconPageList.php

75 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ResponsiveMenu\Form;
4 use ResponsiveMenu\Models\Option;
5 use ResponsiveMenu\Form\FormComponent;
6
7 class FontIconPageList implements FormComponent {
8
9 public function render(Option $option) {
10
11 if($decoded = json_decode($option->getValue()))
12 $final = array_filter(array_combine($decoded->id, $decoded->icon));
13 else
14 $final = null;
15
16 $output = "<div class='font-icon-container'><div class='font-icon-row'><div class='font-icon-cell-id'>" . __('Id', 'responsive-menu') . "</div><div class='font-icon-cell-icon'>" . __('Icon', 'responsive-menu') . "</div></div>";
17
18 if(is_array($final) && !empty($final)):
19 foreach($final as $id => $icon):
20 $output .= "
21 <div class='font-icon-row'>
22 <div class='font-icon-cell-id'>
23 <input
24 type='text'
25 class='{$option->getName()}_id'
26 name='menu[{$option->getName()}][id][]'
27 value='{$id}' />
28 </div>
29 <div class='font-icon-cell-icon'>
30 <input
31 type='text'
32 class='{$option->getName()}_icon'
33 name='menu[{$option->getName()}][icon][]'
34 value='{$icon}' />
35 </div>
36 </div>";
37 endforeach;
38 else:
39 $output .= "
40 <div class='font-icon-row'>
41 <div class='font-icon-cell-id'>
42 <input
43 type='text'
44 class='{$option->getName()}_id'
45 name='menu[{$option->getName()}][id][]'
46 value='' />
47 </div>
48 <div class='font-icon-cell-icon'>
49 <input
50 type='text'
51 class='{$option->getName()}_icon'
52 name='menu[{$option->getName()}][icon][]'
53 value='' />
54 </div>
55 </div>";
56 endif;
57
58 $output .= "</div><div class='add-font-icon'>" . __('Add New Font Icon', 'responsive-menu') . "</div>";
59
60 $output .= "<script>
61 jQuery(document).ready(function($) {
62 $(document).on('click', '.add-font-icon', function(e) {
63 var lastRow = $('#{$option->getName()}_container .font-icon-row').last();
64 var nextRow = lastRow.clone();
65 nextRow.find(':text').val('')
66 lastRow.after(nextRow);
67 });
68 });
69 </script>";
70
71 return $output;
72 }
73
74 }
75