mirror of
				https://github.com/Icinga/icingaweb2.git
				synced 2025-11-04 05:05:01 +01:00 
			
		
		
		
	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.'));
 | 
					        $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
 | 
					        // 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) {
 | 
					        $form->setOnSuccess(function (NavigationConfigForm $form) {
 | 
				
			||||||
            $data = array_filter($form->getValues());
 | 
					            $data = array_filter($form->getValues());
 | 
				
			||||||
 | 
				
			|||||||
@ -74,6 +74,8 @@ class NavigationConfigForm extends ConfigForm
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    protected $itemTypes;
 | 
					    protected $itemTypes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private $defaultUrl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Initialize this form
 | 
					     * Initialize this form
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
@ -680,6 +682,14 @@ class NavigationConfigForm extends ConfigForm
 | 
				
			|||||||
        $itemForm->create($formData); // May require a parent which gets set by addSubForm()
 | 
					        $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
 | 
					     * 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 = $this->getConfigForItem($this->itemToLoad)->getSection($this->itemToLoad)->toArray();
 | 
				
			||||||
            $data['name'] = $this->itemToLoad;
 | 
					            $data['name'] = $this->itemToLoad;
 | 
				
			||||||
            $this->populate($data);
 | 
					            $this->populate($data);
 | 
				
			||||||
 | 
					        } elseif ($this->defaultUrl !== null) {
 | 
				
			||||||
 | 
					            $this->populate(array('url' => $this->defaultUrl));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user