-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMarkupAdminEditableTable.module
More file actions
46 lines (38 loc) · 1003 Bytes
/
MarkupAdminEditableTable.module
File metadata and controls
46 lines (38 loc) · 1003 Bytes
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
<?php
class MarkupAdminEditableTable extends MarkupAdminDataTable {
public static function getModuleInfo() {
return array(
'title' => 'Admin Editable Table',
'summary' => 'Generates XHTML markup for data tables used by ProcessWire admin',
'version' => 101,
'permanent' => false,
);
}
public function init() {
parent::init();
$this->config->styles->add(
$this->config->urls->MarkupAdminDataTable . 'MarkupAdminDataTable.css?v=101'
);
}
protected function setupRow(array $a) {
$row = array();
foreach ($a as $k => $v) {
if (is_string($k)) {
$v = '<a href="' . $v . ' ">' . $this->encode($k) . '</a>';
} else {
if (is_array($v)) {
if (isset($v['input'])) {
$input = $v['input'];
$name = $input['name'];
$value = $input['value'];
$v = '<input type="text" name="' . $name . '" value="' . $value . '" style="width: 90%">';
}
} else {
$v = $this->encode($v);
}
}
$row[] = $v;
}
return $row;
}
}