Nette\Forms\Controls\BaseControl::attached PHP Method

attached() protected method

This method will be called when the component becomes attached to Form.
protected attached ( $form ) : void
return void
    protected function attached($form)
    {
        if (!$this->isDisabled() && $form instanceof Form && $form->isAnchored() && $form->isSubmitted()) {
            $this->loadHttpData();
        }
    }

Usage Example

 /**
  * 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);
 }
All Usage Examples Of Nette\Forms\Controls\BaseControl::attached