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


PHP BaseControl::getHtmlId方法代碼示例

本文整理匯總了PHP中Nette\Forms\Controls\BaseControl::getHtmlId方法的典型用法代碼示例。如果您正苦於以下問題:PHP BaseControl::getHtmlId方法的具體用法?PHP BaseControl::getHtmlId怎麽用?PHP BaseControl::getHtmlId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nette\Forms\Controls\BaseControl的用法示例。


在下文中一共展示了BaseControl::getHtmlId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: attached

 public function attached($form)
 {
     if ($form instanceof Form) {
         /** @var Nette\Forms\Container $container */
         $container = $this->getParent();
         $container->addComponent($this->wrappedControl, $this->componentName);
         $container->addComponent($this->applyButton, $this->componentName . '_apply');
         $this->applyButton->controlPrototype->{'data-apply-button'} = $this->wrappedControl->getHtmlId();
     }
 }
開發者ID:mike227,項目名稱:n-forms,代碼行數:10,代碼來源:ApplyButtonWrapper.php

示例2: createButton

 /**
  * Create button if no button is attached to control
  * @return Was button created or not?
  */
 public function createButton()
 {
     if ($this->button !== null) {
         return false;
     }
     if ($this->isAnyButtonAttached()) {
         $this->button = $this->getAnyAttachedButton(true);
         $this->buttonText = $this->button->getLabel();
         $this->buttonPosition = self::POSITION_UNDEFINED;
         return false;
     }
     // add $this->controlClass to $this->control if not added yet
     $this->updateControlClass();
     // create button
     if ($this->buttonText === null) {
         throw new InvalidArgumentException("Null caption of button is crappy *** !!! (ajax not working properly)");
     }
     $container = $this->control->lookup('Nette\\Forms\\Container');
     $this->button = new SubmitButton($this->buttonText);
     $this->button->setValidationScope(false);
     $this->button->getControlPrototype()->class($this->controlClass . self::$buttonSuffix);
     $this->button->setHtmlId($this->control->getHtmlId() . self::$buttonSuffix);
     $buttonName = $this->formatButtonName($this->control->getName());
     switch ($this->buttonPosition) {
         case self::POSITION_DEFAULT:
             $container->addComponent($this->button, $buttonName);
             break;
         case self::POSITION_BEFORE_CONTROL:
             $container->addComponent($this->button, $buttonName, $this->control->getName());
             break;
         case self::POSITION_AFTER_CONTROL:
             // Uhm :(
             $findName = $this->control->getName();
             $nextName = null;
             $found = false;
             $components = $container->getComponents(true);
             foreach ($components as $name => $component) {
                 if ($found === true) {
                     $nextName = $name;
                     break;
                 }
                 if ($name == $findName) {
                     $found = true;
                 }
             }
             if ($nextName === null) {
                 $container->addComponent($this->button, $buttonName);
             } else {
                 $container->addComponent($this->button, $buttonName, $nextName);
             }
             break;
         default:
             throw new InvalidArgumentException("Ivalid position value !");
     }
     return true;
 }
開發者ID:bazo,項目名稱:dependentselectbox,代碼行數:60,代碼來源:FormControlDependencyHelper.php


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