Permalink
Browse files

monitor with callback

  • Loading branch information...
dg committed Mar 19, 2018
1 parent d348621 commit 6b40e2f4ff44135c54f06ff3de19a1042010d551
Showing with 28 additions and 0 deletions.
  1. +14 −0 cs/components.texy
  2. +14 −0 en/components.texy
@@ -450,6 +450,20 @@ protected function attached($form)
}
\--

Od `nette/component-model` v2.4 je preferovaný způsob předat callbacky přímo metodě `monitor($type, $attached = null, $detached = null)`:

/--php
class UploadControl extends Nette\Forms\Controls\BaseControl
{
public function __construct($label)
{
$this->monitor(Nette\Forms\Form::class, function ($form) {
$form->getElementPrototype()->enctype = 'multipart/form-data';
});
}
}
\--


Iterování nad dětmi
-------------------
@@ -447,6 +447,20 @@ protected function attached($form)
}
\--

Since `nette/component-model` v2.4, the preferred way is to pass the callbacks directly to `monitor($type, $attached = null, $detached = null)`:

/--php
class UploadControl extends Nette\Forms\Controls\BaseControl
{
public function __construct($label)
{
$this->monitor(Nette\Forms\Form::class, function ($form) {
$form->getElementPrototype()->enctype = 'multipart/form-data';
});
}
}
\--


Iterating over Children
-----------------------

0 comments on commit 6b40e2f

Please sign in to comment.