-
Notifications
You must be signed in to change notification settings - Fork 0
/
SiteController.php
44 lines (33 loc) · 1.03 KB
/
SiteController.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
<?php
/**
* @package ImpressPages
*/
namespace Plugin\DateFormField;
class SiteController
{
/**
* Render example form with date field
* Access this controller by visiting example.com?sa=DateFormField
* @return string
*/
public function index()
{
$content = '';
$content .= ipRenderWidget('Heading', array('title' => 'Example usage'));
$form = new \Ip\Form();
$field = new \Plugin\DateFormField\DateField(
array(
'name' => 'inputFieldName', // HTML "name" attribute
'label' => 'Set something to a date', // Field label that will be displayed next to input field
'value' => date('Y-m-d', time()) //1 means on by default
));
$form->addField($field);
$field = new \Ip\Form\Field\Submit (
array(
'value' => 'Submit', // HTML "name" attribute
));
$form->addField($field);
$content .= $form->render();
return $content;
}
}