/**
  * Perform the advanced node action
  */
 public function indexAction()
 {
     $nodeSettings = $this->models['NodeSetting']->getNodeSettings($this->node->id);
     $form = new NodeSettingsForm($this->request->getBasePath(), $nodeSettings);
     if (!$form->isSubmitted()) {
         $this->setAdvancedView($form);
         return;
     }
     if ($form->isCancelled()) {
         $this->response->setRedirect($this->request->getBasePath());
         return;
     }
     try {
         $nodeSettings = $form->getNodeSettings(true);
         $this->models['NodeSetting']->setNodeSettings($nodeSettings);
         $this->clearCache();
         $this->addInformation(self::TRANSLATION_INFORMATION_SAVED, array('name' => $this->node->name));
         $this->response->setRedirect($this->request->getBasePath());
     } catch (ValidationException $saveException) {
         $validationException = new ValidationException();
         $errors = $saveException->getAllErrors();
         foreach ($errors as $fieldErrors) {
             $validationException->addErrors(NodeSettingsForm::FIELD_SETTINGS, $fieldErrors);
         }
         $form->setValidationException($validationException);
         $this->setAdvancedView($form);
     }
 }
 /**
  * Construct this view
  * @param joppa\form\backend\SiteSelectForm $siteSelectForm form to select another site
  * @param joppa\form\backend\NodeSettingsForm $nodeSettingsForm form to edit the node settings
  * @param joppa\model\Site $site the current site
  * @param joppa\model\Node $node the current node
  * @return null
  */
 public function __construct(SiteSelectForm $siteSelectForm, NodeSettingsForm $nodeSettingsForm, Site $site, Node $node)
 {
     parent::__construct($siteSelectForm, $site, $node, 'joppa/backend/node.advanced');
     $nodeSettings = $nodeSettingsForm->getNodeSettings(false);
     $settings = $this->getHtmlFromNodeSettings($nodeSettings);
     $this->set('node', $node);
     $this->set('form', $nodeSettingsForm);
     $this->set('settings', $settings);
     $this->addStyle(self::STYLE);
     $this->addInlineJavascript("joppaInitializeAdvanced();");
 }