/** * This method will be called when the component (or component's parent) * becomes attached to a monitored object. Do not call this method yourself. * @param Nette\ComponentModel\IComponent * @return void */ protected function attached($presenter) { if ($presenter instanceof Presenter) { $name = $this->lookupPath('Nette\Application\UI\Presenter'); if (!isset($this->getElementPrototype()->id)) { $this->getElementPrototype()->id = 'frm-' . $name; } if (iterator_count($this->getControls()) && $this->isSubmitted()) { foreach ($this->getControls() as $control) { if (!$control->isDisabled()) { $control->loadHttpData(); } } } if (!$this->getAction()) { $this->setAction(new Link($presenter, 'this', array())); $signal = new Nette\Forms\Controls\HiddenField($name . self::NAME_SEPARATOR . 'submit'); $signal->setOmitted()->setHtmlId(FALSE); $this[Presenter::SIGNAL_KEY] = $signal; } } parent::attached($presenter); }
/** * This method will be called when the component (or component's parent) * becomes attached to a monitored object. Do not call this method yourself. * @param IComponent * @return void */ protected function attached($presenter) { if ($presenter instanceof Presenter) { $name = $this->lookupPath('Nette\\Application\\Presenter'); if (!isset($this->getElementPrototype()->id)) { $this->getElementPrototype()->id = 'frm-' . $name; } $this->setAction(new Link($presenter, $name . self::NAME_SEPARATOR . 'submit!', array())); // fill-in the form with HTTP data if ($this->isSubmitted()) { foreach ($this->getControls() as $control) { $control->loadHttpData(); } } } parent::attached($presenter); }
/** * This method will be called when the component (or component's parent) * becomes attached to a monitored object. Do not call this method yourself. * @param Nette\ComponentModel\IComponent * @return void */ protected function attached($presenter) { if ($presenter instanceof Presenter) { if (!isset($this->getElementPrototype()->id)) { $this->getElementPrototype()->id = 'frm-' . $this->lookupPath(Presenter::class); } if (!$this->getAction()) { $this->setAction(new Link($presenter, 'this')); } $controls = $this->getControls(); if (iterator_count($controls) && $this->isSubmitted()) { foreach ($controls as $control) { if (!$control->isDisabled()) { $control->loadHttpData(); } } } $this->onAnchor($this); } parent::attached($presenter); }
protected function attached($obj) { parent::attached($obj); if ($obj instanceof Presenter) { if ($this->httpRequest === NULL) { $this->httpRequest = $obj->getContext()->getByType(IRequest::class); } $this->getElementPrototype()->action = substr($this->httpRequest->getUrl(), strlen($this->httpRequest->getUrl()->hostUrl)); $name = $this->lookupPath(Presenter::class); if (!isset($this->getElementPrototype()->id)) { $this->getElementPrototype()->id = 'frm-' . $name; } $this[self::TRACKER_ID] = (new Controls\HiddenField($name))->setOmitted(); if (iterator_count($this->getControls()) && $this->isSubmitted()) { foreach ($this->getControls() as $control) { if (!$control->isDisabled()) { $control->loadHttpData(); } } } } }