-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormBuilder2Plugin.php
executable file
·96 lines (80 loc) · 3.09 KB
/
FormBuilder2Plugin.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
<?php
/*
Plugin Name: FormBuilder 2
Plugin Url: https://github.com/roundhouse/FormBuilder-2
Author: Vadim Goncharov (https://github.com/owldesign)
Author URI: http://roundhouseagency.com
Description: FormBuilder 2 is a Craft CMS plugin that lets you create forms for your front-end.
Version: 0.0.1
*/
namespace Craft;
class FormBuilder2Plugin extends BasePlugin
{
public function init()
{
if (craft()->request->isCpRequest()) {
craft()->templates->hook('formBuilder2.prepCpTemplate', array($this, 'prepCpTemplate'));
}
}
public function getName()
{
return 'FormBuilder 2';
}
public function getVersion()
{
return '0.0.1';
}
public function getDeveloper()
{
return 'Roundhouse Agency';
}
public function getDeveloperUrl()
{
return 'https://github.com/roundhouse';
}
public function getDocumentationUrl()
{
return 'https://github.com/roundhouse/FormBuilder-2-Craft-CMS';
}
public function getDescription()
{
return Craft::t('Simply Forms Manager');;
}
public function hasCpSection()
{
return true;
}
public function getSettingsUrl()
{
return 'formbuilder2/tools/configuration';
}
public function prepCpTemplate(&$context)
{
$context['subnav'] = array();
$context['subnav']['dashboard'] = array('label' => Craft::t('Dashboard'), 'url' => 'formbuilder2/dashboard');
$context['subnav']['forms'] = array('label' => Craft::t('Forms'), 'url' => 'formbuilder2/forms');
$context['subnav']['entries'] = array('label' => Craft::t('Entries'), 'url' => 'formbuilder2/entries');
$context['subnav']['configuration'] = array('icon' => 'settings', 'label' => Craft::t('Configuration'), 'url' => 'formbuilder2/tools/configuration');
}
public function addTwigExtension()
{
Craft::import('plugins.formbuilder2.twigextensions.FormBuilder2TwigExtension');
return new FormBuilder2TwigExtension();
}
public function registerCpRoutes()
{
return array(
'formbuilder2' => array('action' => 'formBuilder2/dashboard'),
'formbuilder2/dashboard' => array('action' => 'formBuilder2/dashboard'),
'formbuilder2/tools/configuration' => array('action' => 'formBuilder2/configurationIndex'),
'formbuilder2/tools/backup-restore' => array('action' => 'formBuilder2/backupRestoreIndex'),
'formbuilder2/tools/export' => array('action' => 'formBuilder2/exportIndex'),
'formbuilder2/forms' => array('action' => 'formBuilder2_Form/formsIndex'),
'formbuilder2/forms/new' => array('action' => 'formBuilder2_Form/editForm'),
'formbuilder2/forms/(?P<formId>\d+)' => array('action' => 'formBuilder2_Form/editForm'),
'formbuilder2/forms/(?P<formId>\d+)/edit' => array('action' => 'formBuilder2_Form/editForm'),
'formbuilder2/entries' => array('action' => 'formBuilder2_Entry/entriesIndex'),
'formbuilder2/entries/(?P<entryId>\d+)/edit' => array('action' => 'formBuilder2_Entry/viewEntry')
);
}
}