HosipLan

Untitled

Jan 5th, 2012
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1.     /**
  2.      * Magical component factory
  3.      *
  4.      * @param \Nette\ComponentModel\IContainer
  5.      */
  6.     protected function attached($obj)
  7.     {
  8.         if ($obj instanceof Nette\Application\UI\Presenter) {
  9.             $this->loadHttpData();
  10.  
  11.             if ($this->createDefault > 0) {
  12.                 if (!$this->getForm()->isSubmitted()) {
  13.                     foreach (range(0, $this->createDefault - 1) as $key) {
  14.                         $this->createComponent($key);
  15.                     }
  16.  
  17.                 } elseif ($this->forceDefault) {
  18.                     while ($this->getContainers()->count() < $this->createDefault) {
  19.                         $this->createOne();
  20.                     }
  21.                 }
  22.             }
  23.         }
  24.  
  25.         parent::attached($obj);
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment