function getConfiguration()
 {
     $config = parent::getConfiguration();
     if ($config['widget']) {
         $config['typeahead'] = $config['widget'] == 'typeahead';
     }
     //Typeahed doesn't support multiselect for now  TODO: Add!
     if ($config['typeahead']) {
         $config['multiselect'] = false;
     }
     return $config;
 }
Exemplo n.º 2
0
 function getConfiguration()
 {
     $config = parent::getConfiguration();
     $_types = self::getFileTypes();
     $mimetypes = array();
     $extensions = array();
     if (isset($config['mimetypes']) && is_array($config['mimetypes'])) {
         foreach ($config['mimetypes'] as $type => $desc) {
             foreach ($_types[$type]['types'] as $mime => $exts) {
                 $mimetypes[$mime] = true;
                 if (is_array($exts)) {
                     foreach ($exts as $ext) {
                         $extensions['.' . $ext] = true;
                     }
                 }
             }
         }
     }
     if (strpos($config['extensions'], '.*') !== false) {
         $config['extensions'] = '';
     }
     if (is_string($config['extensions'])) {
         foreach (preg_split('/\\s+/', str_replace(',', ' ', $config['extensions'])) as $ext) {
             if (!$ext) {
                 continue;
             } elseif (strpos($ext, '/')) {
                 $mimetypes[$ext] = true;
             } else {
                 if ($ext[0] != '.') {
                     $ext = '.' . $ext;
                 }
                 // Ensure that the extension is lower-cased for comparison latr
                 $ext = strtolower($ext);
                 // Add this to the MIME types list so it can be exported to
                 // the @accept attribute
                 if (!isset($extensions[$ext])) {
                     $mimetypes[$ext] = true;
                 }
                 $extensions[$ext] = true;
             }
         }
         $config['__extensions'] = array_keys($extensions);
     } elseif (is_array($config['extensions'])) {
         $config['__extensions'] = $config['extensions'];
     }
     // 'mimetypes' is the array represented from the user interface,
     // '__mimetypes' is a complete list of supported MIME types.
     $config['__mimetypes'] = array_keys($mimetypes);
     return $config;
 }