本文整理匯總了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();
}
}
}
}
}