Skip to content

Commit

Permalink
get picker url parameters via own method
Browse files Browse the repository at this point in the history
  • Loading branch information
rabauss committed Jan 3, 2020
1 parent 2aeda7f commit 32e7023
Showing 1 changed file with 36 additions and 21 deletions.
57 changes: 36 additions & 21 deletions core-bundle/src/Resources/contao/widgets/FileTree.php
Expand Up @@ -368,27 +368,7 @@ public function generate()
}
else
{
$extras = array('fieldType'=>$this->fieldType);

if ($this->files)
{
$extras['files'] = (bool) $this->files;
}

if ($this->filesOnly)
{
$extras['filesOnly'] = (bool) $this->filesOnly;
}

if ($this->path)
{
$extras['path'] = (string) $this->path;
}

if ($this->extensions)
{
$extras['extensions'] = (string) $this->extensions;
}
$extras = $this->getPickerUrlExtras($arrValues);

$return .= '
<p><a href="' . ampersand(System::getContainer()->get('contao.picker.builder')->getUrl('file', $extras)) . '" class="tl_submit" id="ft_' . $this->strName . '">' . $GLOBALS['TL_LANG']['MSC']['changeSelection'] . '</a></p>
Expand Down Expand Up @@ -420,6 +400,41 @@ public function generate()
return $return;
}

/**
* Return the extra parameters for picker url
*
* @param array $values
*
* @return array
*/
protected function getPickerUrlExtras($values = [])
{
$extras = [];
$extras['fieldType'] = $this->fieldType;

if ($this->files)
{
$extras['files'] = (bool) $this->files;
}

if ($this->filesOnly)
{
$extras['filesOnly'] = (bool) $this->filesOnly;
}

if ($this->path)
{
$extras['path'] = (string) $this->path;
}

if ($this->extensions)
{
$extras['extensions'] = (string) $this->extensions;
}

return $extras;
}

/**
* Return the preview image
*
Expand Down

0 comments on commit 32e7023

Please sign in to comment.