Skip to content
Snippets Groups Projects
Commit a7f98bb4 authored by Jared Hancock's avatar Jared Hancock
Browse files

oops: Only parse the filetypes Yaml one time

parent 5ce12926
No related branches found
No related tags found
No related merge requests found
......@@ -1305,6 +1305,14 @@ class FileUploadField extends FormField {
protected $attachments;
static function getFileTypes() {
static $filetypes;
if (!isset($filetypes))
$filetypes = YamlDataParser::load(INCLUDE_DIR . '/config/filetype.yaml');
return $filetypes;
}
function getConfigurationOptions() {
// Compute size selections
$sizes = array('262144' => '— '.__('Small').' —');
......@@ -1326,10 +1334,8 @@ class FileUploadField extends FormField {
if ($next < $limit * 2)
$sizes[$limit] = Format::file_size($limit);
// Load file types
$_types = YamlDataParser::load(INCLUDE_DIR . '/config/filetype.yaml');
$types = array();
foreach ($_types as $type=>$info) {
foreach (self::getFileTypes() as $type=>$info) {
$types[$type] = $info['description'];
}
......@@ -1470,7 +1476,7 @@ class FileUploadField extends FormField {
function getConfiguration() {
$config = parent::getConfiguration();
$_types = YamlDataParser::load(INCLUDE_DIR . '/config/filetype.yaml');
$_types = self::getFileTypes();
$mimetypes = array();
$extensions = array();
if (isset($config['mimetypes']) && is_array($config['mimetypes'])) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment