diff --git a/src/Fields/KeyValueField.php b/src/Fields/KeyValueField.php
index fc41028..a1fffee 100755
--- a/src/Fields/KeyValueField.php
+++ b/src/Fields/KeyValueField.php
@@ -83,8 +83,8 @@ public function Field($properties = [])
Requirements::javascript('symbiote/silverstripe-multivaluefield: client/dist/js/multivaluefield.js');
Requirements::css('symbiote/silverstripe-multivaluefield: client/dist/styles/multivaluefield.css');
- $nameKey = $this->name.'[key][]';
- $nameVal = $this->name.'[val][]';
+ $nameKey = $this->name . '[key][]';
+ $nameVal = $this->name . '[val][]';
$fields = [];
$keyFieldPlaceholder = $this->getKeyFieldPlaceholder();
$valueFieldPlaceholder = $this->getValueFieldPlaceholder();
@@ -93,20 +93,20 @@ public function Field($properties = [])
foreach ($this->value as $i => $v) {
if ($this->readonly) {
$fieldAttr = [
- 'class' => 'mventryfield mvkeyvalReadonly '.($this->extraClass() ? $this->extraClass() : ''),
- 'id' => $this->id().MultiValueTextField::KEY_SEP.$i,
+ 'class' => 'mventryfield mvkeyvalReadonly ' . ($this->extraClass() ? $this->extraClass() : ''),
+ 'id' => $this->id() . MultiValueTextField::KEY_SEP . $i,
'name' => $nameKey,
'tabindex' => $this->getAttribute('tabindex')
];
$keyField = HTML::createTag('span', $fieldAttr, Convert::raw2xml($i));
- $fieldAttr['id'] = $this->id().MultiValueTextField::KEY_SEP.$v;
+ $fieldAttr['id'] = $this->id() . MultiValueTextField::KEY_SEP . $v;
$valField = HTML::createTag('span', $fieldAttr, Convert::raw2xml($v));
- $fields[] = $keyField.$valField;
+ $fields[] = $keyField . $valField;
} else {
$keyField = $this->createSelectList($i, $nameKey, $this->sourceKeys, $i, $keyFieldPlaceholder);
$valField = $this->createSelectList($i, $nameVal, $this->sourceValues, $v, $valueFieldPlaceholder);
- $fields[] = $keyField.' '.$valField;
+ $fields[] = $keyField . ' ' . $valField;
}
}
} else {
@@ -116,14 +116,12 @@ public function Field($properties = [])
if (!$this->readonly) {
$keyField = $this->createSelectList('new', $nameKey, $this->sourceKeys, '', $keyFieldPlaceholder);
$valField = $this->createSelectList('new', $nameVal, $this->sourceValues, '', $valueFieldPlaceholder);
- $fields[] = $keyField.' '.$valField;
-// $fields[] = $this->createSelectList('new', $name, $this->source);
+ $fields[] = $keyField . ' ' . $valField;
+ // $fields[] = $this->createSelectList('new', $name, $this->source);
}
- return '
';
+ return '';
}
protected function createSelectList($number, $name, $values, $selected = '', $placeholder = '')
@@ -133,7 +131,7 @@ protected function createSelectList($number, $name, $values, $selected = '', $pl
[
'selected' => $selected == '' ? 'selected' : '',
'value' => ''
- ],
+ ],
''
);
@@ -147,8 +145,8 @@ protected function createSelectList($number, $name, $values, $selected = '', $pl
if (count($values ?? [])) {
$attrs = [
- 'class' => 'text mventryfield mvdropdown '.($this->extraClass() ? $this->extraClass() : ''),
- 'id' => $this->id().MultiValueTextField::KEY_SEP.$number,
+ 'class' => 'text mventryfield mvdropdown ' . ($this->extraClass() ? $this->extraClass() : ''),
+ 'id' => $this->id() . MultiValueTextField::KEY_SEP . $number,
'name' => $name,
'tabindex' => $this->getAttribute('tabindex')
];
@@ -160,8 +158,8 @@ protected function createSelectList($number, $name, $values, $selected = '', $pl
return HTML::createTag('select', $attrs, $options);
} else {
$attrs = [
- 'class' => 'text mventryfield mvtextfield '.($this->extraClass() ? $this->extraClass() : ''),
- 'id' => $this->id().MultiValueTextField::KEY_SEP.$number,
+ 'class' => 'text mventryfield mvtextfield ' . ($this->extraClass() ? $this->extraClass() : ''),
+ 'id' => $this->id() . MultiValueTextField::KEY_SEP . $number,
'value' => $selected,
'name' => $name,
'tabindex' => $this->getAttribute('tabindex'),
diff --git a/src/Fields/MultiValueDropdownField.php b/src/Fields/MultiValueDropdownField.php
index ec6d27d..e074c24 100755
--- a/src/Fields/MultiValueDropdownField.php
+++ b/src/Fields/MultiValueDropdownField.php
@@ -48,7 +48,7 @@ public function Field($properties = [])
Requirements::javascript('symbiote/silverstripe-multivaluefield: client/dist/js/multivaluefield.js');
Requirements::css('symbiote/silverstripe-multivaluefield: client/dist/styles/multivaluefield.css');
- $name = $this->name.'[]';
+ $name = $this->name . '[]';
$fields = [];
@@ -56,8 +56,9 @@ public function Field($properties = [])
foreach ($this->value as $i => $v) {
if ($this->readonly) {
$fieldAttr = [
- 'class' => 'mventryfield mvdropdownReadonly '.($this->extraClass() ? $this->extraClass() : ''),
- 'id' => $this->id().MultiValueTextField::KEY_SEP.$i,
+ 'class' => 'mventryfield mvdropdownReadonly '
+ . ($this->extraClass() ? $this->extraClass() : ''),
+ 'id' => $this->id() . MultiValueTextField::KEY_SEP . $i,
'name' => $name,
'tabindex' => $this->getAttribute('tabindex')
];
@@ -74,10 +75,10 @@ public function Field($properties = [])
$fields[] = $this->createSelectList($i + 1, $name, $this->source);
}
- return '';
}
public function Type()
@@ -92,7 +93,7 @@ protected function createSelectList($number, $name, $values, $selected = '')
[
'selected' => $selected == '' ? 'selected' : '',
'value' => ''
- ],
+ ],
''
);
@@ -105,8 +106,8 @@ protected function createSelectList($number, $name, $values, $selected = '')
}
$attrs = [
- 'class' => 'mventryfield mvdropdown '.($this->extraClass() ? $this->extraClass() : ''),
- 'id' => $this->id().MultiValueTextField::KEY_SEP.$number,
+ 'class' => 'mventryfield mvdropdown ' . ($this->extraClass() ? $this->extraClass() : ''),
+ 'id' => $this->id() . MultiValueTextField::KEY_SEP . $number,
'name' => $name,
'tabindex' => $this->getAttribute('tabindex')
];
diff --git a/src/Fields/MultiValueListField.php b/src/Fields/MultiValueListField.php
index 0994b71..7d386f3 100755
--- a/src/Fields/MultiValueListField.php
+++ b/src/Fields/MultiValueListField.php
@@ -30,7 +30,7 @@ public function Field($properties = [])
Requirements::javascript('symbiote/silverstripe-multivaluefield: client/dist/js/multivaluefield.js');
Requirements::css('symbiote/silverstripe-multivaluefield: client/dist/styles/multivaluefield.css');
- $name = $this->name.'[]';
+ $name = $this->name . '[]';
$options = '';
if (!$this->value) {
@@ -46,7 +46,7 @@ public function Field($properties = [])
}
$attrs = [
- 'class' => 'mventryfield mvlistbox '.($this->extraClass() ? $this->extraClass() : ''),
+ 'class' => 'mventryfield mvlistbox ' . ($this->extraClass() ? $this->extraClass() : ''),
'id' => $this->id(),
'name' => $name,
'tabindex' => $this->getAttribute('tabindex'),
diff --git a/src/Fields/MultiValueTextField.php b/src/Fields/MultiValueTextField.php
index b4016c1..c6eac8e 100755
--- a/src/Fields/MultiValueTextField.php
+++ b/src/Fields/MultiValueTextField.php
@@ -27,12 +27,12 @@ public function Field($properties = [])
Requirements::javascript('symbiote/silverstripe-multivaluefield: client/dist/js/multivaluefield.js');
Requirements::css('symbiote/silverstripe-multivaluefield: client/dist/styles/multivaluefield.css');
- $name = $this->name.'[]';
+ $name = $this->name . '[]';
$fields = [];
$attributes = [
'type' => 'text',
- 'class' => 'text mvtextfield mventryfield '.($this->extraClass() ? $this->extraClass() : ''),
+ 'class' => 'text mvtextfield mventryfield ' . ($this->extraClass() ? $this->extraClass() : ''),
// 'id' => $this->id(),
'name' => $name,
// 'value' => $this->Value(),
@@ -45,7 +45,7 @@ public function Field($properties = [])
$fieldAttr = $attributes;
if ($this->value) {
foreach ($this->value as $i => $v) {
- $fieldAttr['id'] = $this->id().MultiValueTextField::KEY_SEP.$i;
+ $fieldAttr['id'] = $this->id() . MultiValueTextField::KEY_SEP . $i;
$fieldAttr['value'] = $v;
if ($this->readonly) {
unset($fieldAttr['value']);
@@ -59,17 +59,15 @@ public function Field($properties = [])
// add an empty row
if (!$this->readonly) {
// assume next pos equals to the number of existing fields which gives index+1 in a zero-indexed list
- $attributes['id'] = $this->id().MultiValueTextField::KEY_SEP.count($fields ?? []);
+ $attributes['id'] = $this->id() . MultiValueTextField::KEY_SEP . count($fields ?? []);
$fields[] = $this->createInput($attributes);
}
if (count($fields ?? [])) {
- return '';
+ return '';
} else {
- return '';
+ return '';
}
}