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 Jul 14, 2019
1 parent 50a3027 commit cdd98f8
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions core-bundle/src/Resources/contao/widgets/PageTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,7 @@ public function generate()
}
else
{
$extras = array
(
'fieldType' => $this->fieldType,
'source' => $this->strTable.'.'.$this->currentRecord,
);

if (\is_array($this->rootNodes))
{
$extras['rootNodes'] = array_values($this->rootNodes);
}
$extras = $this->getPickerUrlExtras($arrValues);

$return .= '
<p><a href="' . ampersand(System::getContainer()->get('contao.picker.builder')->getUrl('page', $extras)) . '" class="tl_submit" id="pt_' . $this->strName . '">'.$GLOBALS['TL_LANG']['MSC']['changeSelection'].'</a></p>
Expand Down Expand Up @@ -269,6 +260,26 @@ 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;
$extras['source'] = $this->strTable.'.'.$this->currentRecord;

if (\is_array($this->rootNodes))
{
$extras['rootNodes'] = array_values($this->rootNodes);
}
return $extras;
}
}

class_alias(PageTree::class, 'PageTree');

0 comments on commit cdd98f8

Please sign in to comment.