Skip to content

Commit

Permalink
Fix two issues with the file picker provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Jul 21, 2017
1 parent 3ddf78f commit 1c7a27b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/Picker/FilePickerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,12 @@ public function getDcaAttributes(PickerConfig $config)
*/
public function convertDcaValue(PickerConfig $config, $value)
{
if ('file' === $config->getContext()) {
return $value;
}

/** @var FilesModel $filesAdapter */
$filesAdapter = $this->framework->getAdapter(FilesModel::class);

$filesModel = $filesAdapter->findByPath(rawurldecode($value));

if ($filesModel instanceof FilesModel) {
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/public/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ var Backend =
Backend.openModalSelector({
'id': 'tl_listing',
'title': win.document.getElement('div.mce-title').get('text'),
'url': document.location.pathname.replace('/contao', '/_contao') + '/picker?context=' + (type == 'file' ? 'link' : 'file') + '&value=' + url + '&popup=1',
'url': document.location.pathname.replace('/contao', '/_contao') + '/picker?context=' + (type == 'file' ? 'link' : 'file') + '&extras[fieldType]=radio&extras[filesOnly]=true&value=' + url + '&popup=1',
'callback': function(table, value) {
win.document.getElementById(field_name).value = value.join(',');
}
Expand Down
Loading

0 comments on commit 1c7a27b

Please sign in to comment.