Skip to content

Commit d6e3612

Browse files
authored
Merge pull request #354 from solewniczak/fix-default-value-for-bureaucracy-field
fix: struct_field in bureaucracy form now supports a default value
2 parents 7d5be31 + 131fd50 commit d6e3612

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

helper/field.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ class helper_plugin_struct_field extends helper_plugin_bureaucracy_field {
2222
* @param array $args
2323
*/
2424
public function initialize($args) {
25-
parent::initialize($args);
25+
$this->init($args);
2626

2727
// find the column
2828
try {
2929
$this->column = $this->findColumn($this->opt['label']);
3030
} catch(StructException $e) {
3131
msg(hsc($e->getMessage()), -1);
3232
}
33+
34+
$this->standardArgs($args);
3335
}
3436

3537
/**
@@ -41,7 +43,8 @@ public function initialize($args) {
4143
protected function setVal($value) {
4244
if(!$this->column) {
4345
$value = '';
44-
} else {
46+
//don't validate placeholders here
47+
} elseif($this->replace($value) == $value) {
4548
$validator = new ValueValidator();
4649
$this->error = !$validator->validateValue($this->column, $value);
4750
if($this->error) {

0 commit comments

Comments
 (0)