forked from floriankarsten/kirby-tablex
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtablex.php
More file actions
executable file
·50 lines (37 loc) · 1.13 KB
/
Copy pathtablex.php
File metadata and controls
executable file
·50 lines (37 loc) · 1.13 KB
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
<?php
class TablexField extends BaseField {
static public $assets = [
'js' => [
'lodash.js',
'vue.js',
'tablex.js',
],
'css' => [
'tablex.css'
]
];
public function content() {
$field['name'] = $this->name;
$field['tableData'] = (!empty($this->value()['table']))
? htmlspecialchars(json_encode($this->value()['table']), ENT_QUOTES, 'UTF-8')
: '';
$field['headerData'] = (!empty($this->value()['header']))
? htmlspecialchars(json_encode($this->value()['header']), ENT_QUOTES, 'UTF-8')
: '';
$field['options'] = (!empty($this->options()))
? htmlspecialchars(json_encode($this->options()), ENT_QUOTES, 'UTF-8')
: '';
$field['caption'] = (!empty($this->value()['caption']))
? htmlspecialchars($this->value()['caption'], ENT_QUOTES, 'UTF-8')
: '';
return tpl::load(__DIR__ . DS . 'template.php', compact('field'));
}
public function value() {
$value = parent::value();
return yaml::decode($value);
}
public function result() {
$result = parent::result();
return yaml::encode($result);
}
}