1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-23 14:56:51 +02:00

Update FieldtypeDatetime to support empty/not-empty operators in InputfieldSelector

This commit is contained in:
Ryan Cramer
2020-05-14 12:12:13 -04:00
parent 4633146e20
commit 6f6a301295
2 changed files with 4 additions and 2 deletions

View File

@@ -279,7 +279,7 @@ class FieldtypeDatetime extends Fieldtype {
*/
public function ___getSelectorInfo(Field $field, array $data = array()) {
$a = parent::___getSelectorInfo($field, $data);
$a['operators'] = array('=', '!=', '>', '>=', '<', '<=', '%=', '^=');
$a['operators'] = array('=', '!=', '>', '>=', '<', '<=', '%=', '^=', '=""', '!=""');
return $a;
}

View File

@@ -963,7 +963,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel
$sort = $input->$key;
if($sort !== null) {
$sort = (int) $sort;
$pagefile->sort = $sort;
$pagefile->set('sort', $sort);
if($n !== $sort) $changed = true;
$saveFields = true;
}
@@ -982,6 +982,8 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel
} else if(!$this->isAjax && !$this->overwrite && $pagefile->isTemp() && $sort !== null) {
// if page saved with temporary items when not ajax, those temporary items become non-temp
$pagefile->isTemp(false);
// @todo should the next statement instead be this below?
// if($this->maxFiles > 0) while(count($this->value) > $this->>maxFiles) { ... } ?
if($this->maxFiles == 1) while(count($this->value) > 1) {
$item = $this->value->first();
$this->value->remove($item);