-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormatMicrosoftProtectedLinksConfig.php
More file actions
50 lines (41 loc) · 1.26 KB
/
FormatMicrosoftProtectedLinksConfig.php
File metadata and controls
50 lines (41 loc) · 1.26 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 namespace ProcessWire;
/**
* FormatMicrosoftProtectedLinks module config
*
* Hooks page save to find and replaces Microsoft protected links from
* Outlook/Teams/Office with their original links
*
* @author Australian Antarctic Division
* @copyright 2026 Commonwealth of Australia
*/
class FormatMicrosoftProtectedLinksConfig extends ModuleConfig {
public function getDefaults() {
return [
'formatFields' => []
];
}
public function getInputfields() {
$inputfields = parent::getInputfields();
$fields = array();
foreach($this->wire('fields') as $field) {
if (!$field->type instanceof FieldtypeText) continue; // only show text fields (includes text areas)
$fields[$field->name] = $field;
}
uksort($fields, 'strnatcasecmp');
$fieldset = $this->wire('modules')->get('InputfieldFieldset');
$fieldset->label = $this->_('Fields to format');
$inputfields->add($fieldset);
/** @var InputfieldCheckboxes $f */
$f = $this->wire('modules')->get('InputfieldCheckboxes');
$f->name = 'formatFields';
$f->label = 'Select which fields to format';
$f->icon = 'cube';
$f->optionColumns = 3;
foreach($fields as $field) {
$label = $field->name;
$f->addOption($field->id, $label);
}
$fieldset->add($f);
return $inputfields;
}
}