attached() protected method

This method will be called when the component becomes attached to Form.
protected attached ( $form ) : void
return void
 /**
  * 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);
 }
Beispiel #2
0
 /**
  * @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);
 }
Beispiel #3
0
 /**
  * @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]);
     }
 }
Beispiel #4
0
__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
Beispiel #5
0
 protected function attached($component)
 {
     parent::attached($component);
     $this->componentControlAttached($component);
 }