当前位置: 首页>>代码示例>>PHP>>正文


PHP BaseControl::lookup方法代码示例

本文整理汇总了PHP中Nette\Forms\Controls\BaseControl::lookup方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseControl::lookup方法的具体用法?PHP BaseControl::lookup怎么用?PHP BaseControl::lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Forms\Controls\BaseControl的用法示例。


在下文中一共展示了BaseControl::lookup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createButton

 public function createButton()
 {
     if ($this->button) {
         return FALSE;
     }
     /** @var Nette\Forms\Container $container */
     $container = $this->control->lookup('Nette\\Forms\\Container');
     $name = $this->control->getName() . self::$buttonSuffix;
     $this->button = new SubmitButton("Apply");
     $this->button->setValidationScope(false);
     $container->addComponent($this->button, $name);
     $this->control->getControlPrototype()->addAttributes(array('data-apply-button' => $this->button->getHtmlId()));
     return TRUE;
 }
开发者ID:mike227,项目名称:n-forms,代码行数:14,代码来源:DependencyHelper.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::lookup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。