/**
  * Když není RequestButton požadavek, tak se tento button nezobrazuje.
  *
  * @param IPresenter
  */
 protected function attached($parent)
 {
     if ($parent instanceof \Nette\Application\IPresenter) {
         $backlinkId = $this->form->presenter->getParam(RequestButton::BACKLINK_KEY);
         if (!$backlinkId or !RequestButtonStorage::is($backlinkId)) {
             $this->setDisabled(true);
             $this->getParent()->removeComponent($this);
         }
     }
     parent::attached($parent);
 }
示例#2
0
 /**
  * @param IPresenter|RequestButtonReceiver
  */
 protected function attached($parent)
 {
     if ($parent instanceof IPresenter) {
         $receivedId = $this->form->presenter->getParam(RequestButton::RECEIVED_KEY);
         if ($receivedId and !$this->lookup('Nette\\Forms\\Form') instanceof RequestButtonReceiver and $this->lookupPath('Nette\\Application\\UI\\Presenter', TRUE) === RequestButtonStorage::getName($receivedId) and RequestButtonStorage::is($receivedId)) {
             $this->form->setValues(RequestButtonStorage::getData($receivedId));
             // todo tohle asi neni potreba, protoze to uz obstarave RequestButtonReceiver nebo RequestButtonHelper::prepareForm()
         }
     } else {
         if ($parent instanceof RequestButtonReceiver) {
             $this->formIsPrepared = true;
         }
     }
     parent::attached($parent);
 }