1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\Modules\Users\NonceLogin;
13
14 use ICanBoogie\Operation;
15
16 use Brickrouge\Button;
17 use Brickrouge\Element;
18 use Brickrouge\Form;
19 use Brickrouge\Text;
20
21 class NonceRequestForm extends Form
22 {
23 24 25 26 27
28 static protected function add_assets(\Brickrouge\Document $document)
29 {
30 parent::add_assets($document);
31
32 $document->css->add(DIR . 'public/widget.css');
33 $document->js->add(DIR . 'public/widget.js');
34 }
35
36 public function __construct(array $attributes=array())
37 {
38 parent::__construct
39 (
40 $attributes + array
41 (
42 Form::ACTIONS => new Button
43 (
44 'Send', array
45 (
46 'type' => 'submit',
47 'class' => 'btn-warning'
48 )
49 ),
50
51 Form::RENDERER => 'Simple',
52
53 Form::HIDDENS => array
54 (
55 Operation::DESTINATION => 'users.noncelogin',
56 Operation::NAME => 'nonce-login-request'
57 ),
58
59 Element::CHILDREN => array
60 (
61 'email' => new Text
62 (
63 array
64 (
65 Form::LABEL => 'your_email',
66 Element::REQUIRED => true
67 )
68 )
69 ),
70
71 Element::WIDGET_CONSTRUCTOR => 'NonceRequest',
72
73 'class' => 'widget-nonce-request',
74 'name' => 'users/nonce-request'
75 )
76 );
77 }
78 }