HosipLan

Untitled

Feb 3rd, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1.  
  2.  
  3. /**
  4.  * @method onAttached(\BaseForm $form, \BasePresenter $presenter)
  5.  * @method onError(\Nette\Forms\Form $form)
  6.  *
  7.  * @property \BasePresenter $presenter
  8.  * @property-read \BasePresenter $presenter
  9.  */
  10. class BaseForm extends \Nette\Application\UI\Form
  11. {
  12.  
  13.     /**
  14.      * @var array of function (BaseForm $form, Nette\Application\UI\Presenter $presenter)
  15.      */
  16.     public $onAttached = array();
  17.  
  18.  
  19.  
  20.     public function __construct()
  21.     {
  22.         parent::__construct();
  23.  
  24.         $this->getElementPrototype()->novalidate = "novalidate";
  25.     }
  26.  
  27.  
  28.  
  29.     protected function attached($parent)
  30.     {
  31.         parent::attached($parent);
  32.  
  33.         if (!$parent instanceof Nette\Application\UI\Presenter) {
  34.             return;
  35.         }
  36.  
  37.         $this->setTranslator($this->presenter->context->getByType('Nette\Localization\ITranslator'));
  38.  
  39.         $this->onAttached($this, $parent);
  40.     }
Advertisement
Add Comment
Please, Sign In to add comment