NavigationController: Pass through the default url without creating the form
This commit is contained in:
parent
aa3bff532e
commit
b80cfe7cdc
|
@ -206,7 +206,7 @@ class NavigationController extends Controller
|
|||
$form->addDescription($this->translate('Create a new navigation item, such as a menu entry or dashlet.'));
|
||||
|
||||
// TODO: Fetch all "safe" parameters from the url and populate them
|
||||
$form->populate(array('url' => rawurldecode($this->params->get('url', ''))));
|
||||
$form->setDefaultUrl(rawurldecode($this->params->get('url', '')));
|
||||
|
||||
$form->setOnSuccess(function (NavigationConfigForm $form) {
|
||||
$data = array_filter($form->getValues());
|
||||
|
|
|
@ -74,6 +74,8 @@ class NavigationConfigForm extends ConfigForm
|
|||
*/
|
||||
protected $itemTypes;
|
||||
|
||||
private $defaultUrl;
|
||||
|
||||
/**
|
||||
* Initialize this form
|
||||
*/
|
||||
|
@ -680,6 +682,14 @@ class NavigationConfigForm extends ConfigForm
|
|||
$itemForm->create($formData); // May require a parent which gets set by addSubForm()
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE! This will be removed soon, very soon...
|
||||
*/
|
||||
public function setDefaultUrl($url)
|
||||
{
|
||||
$this->defaultUrl = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the configuration of the navigation item to load
|
||||
*/
|
||||
|
@ -689,6 +699,8 @@ class NavigationConfigForm extends ConfigForm
|
|||
$data = $this->getConfigForItem($this->itemToLoad)->getSection($this->itemToLoad)->toArray();
|
||||
$data['name'] = $this->itemToLoad;
|
||||
$this->populate($data);
|
||||
} elseif ($this->defaultUrl !== null) {
|
||||
$this->populate(array('url' => $this->defaultUrl));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue