mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Merge pull request #3534 from Deltik/fix-3533
Sorting for "templates" type e_form::renderElement()
This commit is contained in:
@@ -84,6 +84,20 @@ class e_form
|
|||||||
$this->setRequiredString('<span class="required">* </span>');
|
$this->setRequiredString('<span class="required">* </span>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
* @see https://github.com/e107inc/e107/issues/3533
|
||||||
|
*/
|
||||||
|
private static function sort_get_files_output($tmp)
|
||||||
|
{
|
||||||
|
usort($tmp, function ($left, $right) {
|
||||||
|
$left_full_path = $left['path'] . $left['fname'];
|
||||||
|
$right_full_path = $right['path'] . $right['fname'];
|
||||||
|
return strcmp($left_full_path, $right_full_path);
|
||||||
|
});
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function addWarning($field)
|
public function addWarning($field)
|
||||||
{
|
{
|
||||||
@@ -6046,7 +6060,7 @@ class e_form
|
|||||||
$location = vartrue($parms['plugin']) ? e_PLUGIN.$parms['plugin'].'/' : e_THEME;
|
$location = vartrue($parms['plugin']) ? e_PLUGIN.$parms['plugin'].'/' : e_THEME;
|
||||||
$ilocation = vartrue($parms['location']);
|
$ilocation = vartrue($parms['location']);
|
||||||
$tmp = e107::getFile()->get_files($location.'templates/'.$ilocation, vartrue($parms['fmask'], '_template\.php$'), vartrue($parms['omit'], 'standard'), vartrue($parms['recurse_level'], 0));
|
$tmp = e107::getFile()->get_files($location.'templates/'.$ilocation, vartrue($parms['fmask'], '_template\.php$'), vartrue($parms['omit'], 'standard'), vartrue($parms['recurse_level'], 0));
|
||||||
foreach($tmp as $files)
|
foreach(self::sort_get_files_output($tmp) as $files)
|
||||||
{
|
{
|
||||||
$k = str_replace('_template.php', '', $files['fname']);
|
$k = str_replace('_template.php', '', $files['fname']);
|
||||||
$templates[$k] = implode(' ', array_map('ucfirst', explode('_', $k))); //TODO add LANS?
|
$templates[$k] = implode(' ', array_map('ucfirst', explode('_', $k))); //TODO add LANS?
|
||||||
@@ -6056,7 +6070,7 @@ class e_form
|
|||||||
$where = vartrue($parms['area'], 'front');
|
$where = vartrue($parms['area'], 'front');
|
||||||
$location = vartrue($parms['plugin']) ? $parms['plugin'].'/' : '';
|
$location = vartrue($parms['plugin']) ? $parms['plugin'].'/' : '';
|
||||||
$tmp = e107::getFile()->get_files(e107::getThemeInfo($where, 'rel').'templates/'.$location.$ilocation, vartrue($parms['fmask']), vartrue($parms['omit'], 'standard'), vartrue($parms['recurse_level'], 0));
|
$tmp = e107::getFile()->get_files(e107::getThemeInfo($where, 'rel').'templates/'.$location.$ilocation, vartrue($parms['fmask']), vartrue($parms['omit'], 'standard'), vartrue($parms['recurse_level'], 0));
|
||||||
foreach($tmp as $files)
|
foreach(self::sort_get_files_output($tmp) as $files)
|
||||||
{
|
{
|
||||||
$k = str_replace('_template.php', '', $files['fname']);
|
$k = str_replace('_template.php', '', $files['fname']);
|
||||||
$templates[$k] = implode(' ', array_map('ucfirst', explode('_', $k))); //TODO add LANS?
|
$templates[$k] = implode(' ', array_map('ucfirst', explode('_', $k))); //TODO add LANS?
|
||||||
|
Reference in New Issue
Block a user