PluginProbe
The Innovative Form Builder – IvyForms / 1.0
The Innovative Form Builder – IvyForms v1.0
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / Menu / MenuMapper.php

MenuMapper.php in The Innovative Form Builder – IvyForms 1.0, at backend/src/Services/Menu/MenuMapper.php

82 lines 3.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IvyForms\Services\Menu;
4
5 use IvyForms\Services\API\IvyFormsAPI;
6 use IvyForms\Services\Translations\BackendStrings;
7
8 /**
9 * Class Menu
10 */
11 class MenuMapper
12 {
13 /**
14 * @return mixed[]
15 */
16 public function __invoke(): array
17 {
18 $menus =
19 [
20 // [
21 // 'parentSlug' => 'ivyforms',
22 // 'pageTitle' => 'Dashboard',
23 // 'menuTitle' => BackendStrings::getDashboardStrings()['dashboard'],
24 // 'capability' => 'manage_options',
25 // 'menuSlug' => 'ivyforms-dashboard',
26 // ],
27 [
28 'parentSlug' => 'ivyforms',
29 'pageTitle' => 'All Forms',
30 'menuTitle' => BackendStrings::getCommonStrings()['all_forms'],
31 'capability' => 'manage_options',
32 'menuSlug' => 'ivyforms-forms',
33 ],
34 [
35 'parentSlug' => 'ivyforms',
36 'pageTitle' => 'New form',
37 'menuTitle' => BackendStrings::getCommonStrings()['new_form'],
38 'capability' => 'manage_options',
39 'menuSlug' => 'ivyforms-builder',
40 ],
41 [
42 'parentSlug' => 'ivyforms',
43 'pageTitle' => 'Entries',
44 'menuTitle' => BackendStrings::getEntriesStrings()['entries'],
45 'capability' => 'manage_options',
46 'menuSlug' => 'ivyforms-entries',
47 ],
48 // // TODO Add Settings page
49 [
50 'parentSlug' => 'ivyforms',
51 'pageTitle' => 'Settings',
52 'menuTitle' => BackendStrings::getCommonStrings()['settings'],
53 'capability' => 'manage_options',
54 'menuSlug' => 'ivyforms-settings',
55 ],
56 [
57 'parentSlug' => 'ivyforms',
58 'pageTitle' => 'Integrations',
59 'menuTitle' => BackendStrings::getIntegrationsStrings()['integrations'],
60 'capability' => 'manage_options',
61 'menuSlug' => 'ivyforms-integrations',
62 ],
63 ];
64
65 // Add "Upgrade to PRO" menu only if Pro plugin is not installed/activated
66 if (!IvyFormsAPI::isProPluginActive()) {
67 $menus[] = [
68 'parentSlug' => 'ivyforms',
69 'pageTitle' => 'Upgrade to PRO',
70 // phpcs:ignore Generic.Files.LineLength.TooLong
71 'menuTitle' => '<span class="ivyforms-upgrade-to-pro">' . __('Upgrade to PRO', 'ivyforms') . '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M3.30739 5.78346L5.09363 3.36669C6.24826 1.80449 6.82558 1.02339 7.3642 1.18846C7.90283 1.35352 7.90283 2.31153 7.90283 4.22757V4.40823C7.90283 5.0993 7.90283 5.44483 8.12364 5.66157L8.13533 5.6728C8.36091 5.88496 8.72054 5.88496 9.4398 5.88496C10.7341 5.88496 11.3813 5.88496 11.6 6.27751C11.6037 6.28401 11.6072 6.29056 11.6106 6.29716C11.8171 6.69579 11.4424 7.20277 10.6929 8.21673L8.90667 10.6335C7.75202 12.1957 7.1747 12.9768 6.63607 12.8117C6.09744 12.6466 6.09746 11.6886 6.09748 9.77256L6.09749 9.59198C6.0975 8.9009 6.0975 8.55536 5.87669 8.33861L5.865 8.32739C5.63942 8.11522 5.27979 8.11522 4.56052 8.11522C3.26618 8.11522 2.61901 8.11522 2.40029 7.72267C2.39666 7.71617 2.39314 7.70962 2.38973 7.70302C2.18325 7.3044 2.55796 6.79742 3.30739 5.78346Z" fill="white"/></svg></span>',
72 'capability' => 'manage_options',
73 // phpcs:ignore Generic.Files.LineLength.TooLong
74 'menuSlug' => 'https://ivyforms.com/pricing?utm_source=ivy-lite&utm_medium=lite-upgrade&utm_content=ivy&utm_campaign=ivy',
75 'isExternal' => true,
76 ];
77 }
78
79 return $menus;
80 }
81 }
82