protected function loadModifiedBpConfig() { $bp = $this->loadBpConfig(); $changes = ProcessChanges::construct($bp, $this->session()); if ($this->params->get('dismissChanges')) { Notification::success(sprintf($this->translate('%d pending change(s) have been dropped'), $changes->count())); $changes->clear(); $this->redirectNow($this->url()->without('dismissChanges')->without('unlocked')); } $bp->applyChanges($changes); return $bp; }
public function onSuccess() { $changes = ProcessChanges::construct($this->process, $this->session); $modifications = array(); $children = $this->getValue('children'); $alias = $this->getValue('alias'); $operator = $this->getValue('operator'); $display = $this->getValue('display'); $url = $this->getValue('url'); if (empty($url)) { $url = null; } if (empty($alias)) { $alias = null; } ksort($children); // TODO: rename if ($node = $this->node) { if ($display !== $node->getDisplay()) { $modifications['display'] = $display; } if ($operator !== $node->getOperator()) { $modifications['operator'] = $operator; } if ($children !== $node->getChildNames()) { $modifications['childNames'] = $children; } if ($url !== $node->getInfoUrl()) { $modifications['infoUrl'] = $url; } if ($alias !== $node->getAlias()) { $modifications['alias'] = $alias; } } else { $modifications = array('display' => $display, 'operator' => $operator, 'childNames' => $children, 'infoUrl' => $url, 'alias' => $alias); } if (!empty($modifications)) { if ($this->node === null) { $changes->createNode($this->getValue('name'), $modifications); } else { $changes->modifyNode($this->node, $modifications); } Notification::success(sprintf('Process %s has been modified', $this->process->getName())); } }