attached() protected méthode

This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.
protected attached ( $form ) : void
Résultat void
Exemple #1
0
 protected function attached($form)
 {
     parent::attached($form);
     $this->fileEntity = Objects::hasProperty($this->parent->data, $this->name) ? Objects::getProperty($this->parent->data, $this->name) : NULL;
     if ($this->fileEntity instanceof \Doctrine\Common\Collections\Collection) {
         $this->multi = true;
     }
 }
 protected function attached($form)
 {
     parent::attached($form);
     if ($form instanceof Form) {
         $this->checkbox->setParent($form, $form->getName());
         if (!$form->onSuccess) {
             $form->onSuccess = [];
         }
         array_unshift($form->onSuccess, [$this, 'successCallback']);
     }
     if ($form instanceof IPresenter) {
         $this->checkbox->setPrepend($this->getHtmlName());
         $this->checkbox->setFile($this->defaultValue);
         $this->checkbox->setWwwDir($form->context->parameters['wwwDir']);
     }
 }
Exemple #3
0
 /**
  * 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 IComponent $form
  * @return void
  */
 protected function attached($form)
 {
     parent::attached($form);
     if ($form instanceof Form) {
         $this->checkbox->setParent($form, $form->getName());
     }
     if ($form instanceof IPresenter) {
         if (isset($form->imageStorage) && $form->imageStorage instanceof IImageStorage) {
             $this->storage = $form->imageStorage;
         } else {
             $this->storage = $form->context->getByType(IImageStorage::class);
         }
         $this->checkbox->setPrepend($this->getHtmlName());
         $this->checkbox->setStorage($this->storage);
         $this->checkbox->setImageName($this->defaultValue);
         if ($this->required && !$this->checkbox->isOk()) {
             $this->addRule(Form::FILLED, is_string($this->required) ? $this->required : NULL);
         }
     }
 }
Exemple #4
0
 /**
  * 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 IComponent $form
  * @return void
  */
 protected function attached($form)
 {
     parent::attached($form);
     if ($form instanceof IPresenter) {
         if (isset($form->imageStorage) && $form->imageStorage instanceof IImageStorage) {
             $this->storage = $form->imageStorage;
         } else {
             $this->storage = $form->context->getByType(IImageStorage::class);
         }
         $form = $this->getForm();
         $htmlName = str_replace('[]', '', $this->getHtmlName());
         foreach ($this->defaultValues as $i => $defaultValue) {
             $checkbox = new Checkbox();
             $checkbox->setParent($form, $i);
             $checkbox->setPrepend($htmlName . $i);
             $checkbox->setStorage($this->storage);
             $checkbox->setImageName($defaultValue);
             $this->checkboxes[] = $checkbox;
         }
         if ($this->required && !$this->getCheckboxesFine()) {
             $this->addRule(Form::FILLED, $this->getRequiredMessage());
         }
     }
 }
 /**
  * This method will be called when the component becomes attached to Form
  *
  * @param  Nette\ComponentModel\IComponent
  */
 public function attached($form)
 {
     parent::attached($form);
     $this->template = $this->createTemplate();
 }
 /**
  * @param $form
  */
 protected function attached($form)
 {
     parent::attached($form);
     $this->form->addComponent($this->controller, "uploadController");
 }