本文整理汇总了PHP中Nette\Forms\Form::attached方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::attached方法的具体用法?PHP Form::attached怎么用?PHP Form::attached使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Forms\Form
的用法示例。
在下文中一共展示了Form::attached方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attached
/**
* 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\ComponentModel\IComponent
* @return void
*/
protected function attached($presenter)
{
if ($presenter instanceof Presenter) {
$name = $this->lookupPath('Nette\Application\UI\Presenter');
if (!isset($this->getElementPrototype()->id)) {
$this->getElementPrototype()->id = 'frm-' . $name;
}
if (iterator_count($this->getControls()) && $this->isSubmitted()) {
foreach ($this->getControls() as $control) {
if (!$control->isDisabled()) {
$control->loadHttpData();
}
}
}
if (!$this->getAction()) {
$this->setAction(new Link($presenter, 'this', array()));
$signal = new Nette\Forms\Controls\HiddenField($name . self::NAME_SEPARATOR . 'submit');
$signal->setOmitted()->setHtmlId(FALSE);
$this[Presenter::SIGNAL_KEY] = $signal;
}
}
parent::attached($presenter);
}
示例2: attached
/**
* 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
* @return void
*/
protected function attached($presenter)
{
if ($presenter instanceof Presenter) {
$name = $this->lookupPath('Nette\\Application\\Presenter');
if (!isset($this->getElementPrototype()->id)) {
$this->getElementPrototype()->id = 'frm-' . $name;
}
$this->setAction(new Link($presenter, $name . self::NAME_SEPARATOR . 'submit!', array()));
// fill-in the form with HTTP data
if ($this->isSubmitted()) {
foreach ($this->getControls() as $control) {
$control->loadHttpData();
}
}
}
parent::attached($presenter);
}
示例3: attached
/**
* 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\ComponentModel\IComponent
* @return void
*/
protected function attached($presenter)
{
if ($presenter instanceof Presenter) {
if (!isset($this->getElementPrototype()->id)) {
$this->getElementPrototype()->id = 'frm-' . $this->lookupPath(Presenter::class);
}
if (!$this->getAction()) {
$this->setAction(new Link($presenter, 'this'));
}
$controls = $this->getControls();
if (iterator_count($controls) && $this->isSubmitted()) {
foreach ($controls as $control) {
if (!$control->isDisabled()) {
$control->loadHttpData();
}
}
}
$this->onAnchor($this);
}
parent::attached($presenter);
}
示例4: attached
protected function attached($obj)
{
parent::attached($obj);
if ($obj instanceof Presenter) {
if ($this->httpRequest === NULL) {
$this->httpRequest = $obj->getContext()->getByType(IRequest::class);
}
$this->getElementPrototype()->action = substr($this->httpRequest->getUrl(), strlen($this->httpRequest->getUrl()->hostUrl));
$name = $this->lookupPath(Presenter::class);
if (!isset($this->getElementPrototype()->id)) {
$this->getElementPrototype()->id = 'frm-' . $name;
}
$this[self::TRACKER_ID] = (new Controls\HiddenField($name))->setOmitted();
if (iterator_count($this->getControls()) && $this->isSubmitted()) {
foreach ($this->getControls() as $control) {
if (!$control->isDisabled()) {
$control->loadHttpData();
}
}
}
}
}