-
Notifications
You must be signed in to change notification settings - Fork 4
/
structuretab.php
52 lines (40 loc) · 1.12 KB
/
structuretab.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
<?php
class StructuretabField extends InputField {
static public $assets = array(
'js' => array(
'structuretab.js'
),
'css' => array(
'structuretab.css'
)
);
public function input() {
$input = new Brick('input', null);
$input->addClass('structuretab');
$input->attr(array(
'id' => $this->id(),
'name' => $this->name(),
'required' => $this->required(),
'autofocus' => $this->autofocus(),
'autocomplete' => $this->autocomplete(),
'readonly' => $this->readonly(),
'type' => 'checkbox',
'checked' => v::accepted($this->value()),
));
$wrapper = parent::input();
$wrapper->tag('label');
$wrapper->text($this->i18n($this->text()));
$wrapper->attr('for', $this->id());
$wrapper->removeAttr('id');
$wrapper->addClass('structuretab');
$wrapper->prepend($input);
return $wrapper;
}
public function result() {
$result = parent::result();
return v::accepted($result) ? true : false;
}
public function validate() {
return v::accepted($this->value());
}
}