MVC/field types, add sorting for list types. closes https://github.com/opnsense/core/issues/3251

We should refactor some code later, but there's no rush. issue in https://github.com/opnsense/core/issues/3252
This commit is contained in:
Ad Schellevis 2019-02-26 11:26:05 +01:00
parent 8170be76e6
commit 560a6cb79e
7 changed files with 10 additions and 1 deletions

View File

@ -79,6 +79,7 @@ class AuthGroupField extends BaseField
foreach ($cnf->system->group as $group) {
self::$internalOptionList[(string)$group->gid] = (string)$group->name;
}
natcasesort(self::$internalOptionList);
}
}
}
@ -104,7 +105,6 @@ class AuthGroupField extends BaseField
}
$result[$optKey] = array("value" => $optValue, "selected" => $selected);
}
return $result;
}

View File

@ -101,6 +101,7 @@ class AuthenticationServerField extends BaseField
self::$internalOptionList[$this->internalCacheKey][$key] = $key;
}
}
natcasesort(self::$internalOptionList[$this->internalCacheKey]);
}
}

View File

@ -104,6 +104,7 @@ class CertificateField extends BaseField
foreach ($configObj->{$this->certificateType} as $cert) {
self::$internalOptionList[$this->certificateType][(string)$cert->refid] = (string)$cert->descr;
}
natcasesort(self::$internalOptionList[$this->certificateType]);
}
}

View File

@ -110,6 +110,7 @@ class ConfigdActionsField extends BaseField
}
}
}
natcasesort(self::$internalOptionList[$this->internalCacheKey]);
}
}

View File

@ -82,6 +82,7 @@ class CountryField extends BaseField
}
}
}
natcasesort(self::$internalOptionList);
}
}

View File

@ -190,6 +190,7 @@ class InterfaceField extends BaseField
!empty($value->descr) ? (string)$value->descr : strtoupper($key);
}
}
natcasesort(self::$internalOptionList[$this->internalCacheKey]);
}
}

View File

@ -145,6 +145,10 @@ class ModelRelationField extends BaseField
}
unset($modelObj);
}
if (!$this->internalIsSorted) {
natcasesort(self::$internalOptionList[$this->internalCacheKey]);
}
}
}