當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Form::attached方法代碼示例

本文整理匯總了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);
	}
開發者ID:nakoukal,項目名稱:fakturace,代碼行數:32,代碼來源:Form.php

示例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);
 }
開發者ID:jff15,項目名稱:travelbot,代碼行數:23,代碼來源:AppForm.php

示例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);
 }
開發者ID:hrach,項目名稱:nette-application,代碼行數:27,代碼來源:Form.php

示例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();
                 }
             }
         }
     }
 }
開發者ID:librette,項目名稱:confirmation-dialog,代碼行數:22,代碼來源:ConfirmationForm.php


注:本文中的Nette\Forms\Form::attached方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。