[admin] torrent add more bulk action

This commit is contained in:
xiaomlove
2022-10-02 21:14:11 +08:00
parent cdaec9bc62
commit bb000fb67a
28 changed files with 313 additions and 28 deletions

View File

@@ -51,4 +51,19 @@ class NexusModel extends Model
return sprintf('%s: %s', nexus_trans('label.deadline'), $raw);
}
public static function listStaticProps($dataSource, $textTransPrefix, $onlyKeyValue = false, $valueField = 'text'): array
{
$result = $dataSource;
$keyValue = [];
foreach ($result as $key => &$info) {
$text = $textTransPrefix ? nexus_trans("$textTransPrefix.$key") : $info['text'];
$info['text'] = $text;
$keyValue[$key] = $info[$valueField];
}
if ($onlyKeyValue) {
return $keyValue;
}
return $result;
}
}