PluginProbe
Responsive Menu – Create Mobile-Friendly Menu / 3.0.6
Responsive Menu – Create Mobile-Friendly Menu v3.0.6
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 / ViewModels / Components / Admin / Boxes.php

Boxes.php in Responsive Menu – Create Mobile-Friendly Menu 3.0.6, at src/app/ViewModels/Components/Admin/Boxes.php

103 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ResponsiveMenu\ViewModels\Components\Admin;
4 use ResponsiveMenu\Collections\OptionsCollection as OptionsCollection;
5 use ResponsiveMenu\Form as Form;
6
7 class Boxes {
8
9 private $config;
10
11 public function __construct(array $config, OptionsCollection $options) {
12 $this->config = $config;
13 $this->options = $options;
14 }
15
16 public function render() {
17
18 foreach($this->config as $tab_name => $sub_menus):
19 echo '<div class="tab_container" id="tab_container_' . $this->i($tab_name) . '">';
20 foreach($sub_menus as $sub_menu_name => $options):
21 echo '
22 <div class="postbox" id="postbox_' . $this->i($sub_menu_name).'">
23 <div class="handlediv">
24 <button aria-expanded="true" class="button-link" type="button">
25 <span class="screen-reader-text">' . __('Toggle panel: Location', 'responsive-menu') . '</span>
26 <span aria-hidden="true" class="toggle-indicator"></span>
27 </button>
28 </div> <!-- .handlediv -->
29 <h2 class="ui-sortable-handle hndle">' . $tab_name . ' &raquo; ' . $sub_menu_name . '</h2>
30 <div class="inside">
31 <table class="widefat">';
32 foreach($options as $option):
33 $pro = isset($option['pro']) ? 'pro_option' : '';
34 $semi_pro = isset($option['semi_pro']) ? 'semi_pro_option' : '';
35 $type = isset($option['type']) ? $option['type'] : null;
36 $unit = isset($option['unit']) ? '<span class="units">' . $option['unit'] . '</span>' : null;
37 $select = isset($option['select']) ? $option['select'] : null;
38 echo '<tr class="' . $pro . ' ' . $semi_pro . '" id="' . $option['option'] . '_container">
39 <td>
40 <div class="label">' . $option['title'] . '</div>
41 <span class="description">' . $option['label'] . '</span>
42 </td>
43 <td>';
44 $this->f($type, $option['option'], $select);
45 echo $unit . '</td>
46 </tr>';
47 endforeach;
48 echo '</table>
49 </div> <!-- .inside -->
50 </div> <!-- .postbox -->';
51 endforeach;
52 echo '</div> <!-- .tab_container -->';
53 endforeach;
54 }
55
56 public function i($data) {
57 return strtolower(str_replace([' ', '/'], '_', $data));
58 }
59
60 public function f($type, $option_name, $select) {
61 switch($type):
62 case 'checkbox' : $comp = new Form\Checkbox;
63 $comp->render($this->options[$option_name]);
64 break;
65 case 'colour' : $comp = new Form\Colour;
66 $comp->render($this->options[$option_name]);
67 break;
68 case 'textarea' : $comp = new Form\TextArea;
69 $comp->render($this->options[$option_name]);
70 break;
71 case 'select' : $comp = new Form\Select;
72 $comp->render($this->options[$option_name], $select);
73 break;
74 case 'image' : $comp = new Form\Image;
75 $comp->render($this->options[$option_name]);
76 break;
77 case 'menu_ordering' : $comp = new Form\MenuOrdering;
78 $comp->render($this->options[$option_name]);
79 break;
80 case 'header_ordering' : $comp = new Form\HeaderBarOrdering;
81 $comp->render($this->options[$option_name]);
82 break;
83 case 'fonticons' : $comp = new Form\FontIconPageList;
84 $comp->render($this->options[$option_name]);
85 break;
86 case 'import' : $comp = new Form\Import;
87 $comp->render();
88 break;
89 case 'export' : $comp = new Form\Export;
90 $comp->render();
91 break;
92 case 'reset' : $comp = new Form\Reset;
93 $comp->render();
94 break;
95 default : $comp = new Form\Text;
96 $comp->render($this->options[$option_name]);
97 break;
98 endswitch;
99
100 }
101
102 }
103