/** * 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\Forms\IComponent * @return void */ protected function attached($form) { if ($form instanceof Nette\Forms\Form) { if ($form->getMethod() !== Nette\Forms\Form::POST) { throw new Nette\InvalidStateException('File upload requires method POST.'); } $form->getElementPrototype()->enctype = 'multipart/form-data'; } parent::attached($form); }
/** * @param \Nette\ComponentModel\Container $parent * @throws \Nette\InvalidStateException * @return void */ protected function attached($parent) { if ($parent instanceof Nette\Forms\Form) { if ($parent->getMethod() !== Nette\Forms\Form::POST) { throw new Nette\InvalidStateException('File upload requires method POST.'); } $parent->getElementPrototype()->enctype = 'multipart/form-data'; } elseif ($parent instanceof Nette\Application\UI\Presenter) { if (!$this->httpRequest) { $this->httpRequest = $parent->getContext()->httpRequest; $this->httpResponse = $parent->getContext()->httpResponse; } } parent::attached($parent); }
/** * @param $component */ protected function attached($component) { parent::attached($component); if ($component instanceof Nette\Application\IPresenter) { $this->presenter = $component; // build links $this->remoteLink = $this->link($component, 'remote!', ['q' => self::QUERY_PLACEHOLDER]); } }
__construct($label=NULL){parent::__construct($label);$this->control->type='file';}protected function attached($form){if($form instanceof Nette\Forms\Form){if($form->getMethod()!==Nette\Forms\Form::POST){throw new Nette\InvalidStateException('File upload requires method POST.');}$form->getElementPrototype()->enctype='multipart/form-data';}parent::attached($form);}function
protected function attached($component) { parent::attached($component); $this->componentControlAttached($component); }