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


PHP Presenter::createComponent方法代码示例

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


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

示例1: createComponent

 /**
  * @param $name
  * @return Nette\ComponentModel\IComponent
  * to have translated even forms add this method too
  */
 protected function createComponent($name)
 {
     $component = parent::createComponent($name);
     if ($component instanceof Form) {
     }
     return $component;
 }
开发者ID:buffus,项目名称:skeleton,代码行数:12,代码来源:BasePresenter.php

示例2: createComponent

 /**
  * @param string $name
  * @return \Nette\ComponentModel\IComponent
  */
 protected function createComponent($name = NULL)
 {
     $method = 'createComponent' . ucfirst($name);
     $rc = $this->getReflection()->getMethod($method);
     $this->checkRequirements($rc);
     return parent::createComponent($name);
 }
开发者ID:brosland,项目名称:framework,代码行数:11,代码来源:Presenter.php

示例3: createComponent

 /**
  * @param string $name
  * @return IComponent
  */
 protected function createComponent($name)
 {
     $component = parent::createComponent($name);
     if ($component instanceof \Nette\Forms\Form) {
         $component->setTranslator($this->translator);
     }
     return $component;
 }
开发者ID:shophp,项目名称:shophp,代码行数:12,代码来源:BasePresenter.php

示例4: createComponent

 public function createComponent($name)
 {
     $ucname = ucfirst($name);
     $method = 'createComponent' . $ucname;
     $presenterReflection = $this->getReflection();
     if ($presenterReflection->hasMethod($method)) {
         $reflection = $presenterReflection->getMethod($method);
         $this->checkRequirements($reflection);
         $annotations = (array) $reflection->getAnnotation('Action');
         if (!empty($annotations) && !in_array($this->getAction(), $annotations)) {
             throw new ForbiddenRequestException("Creation of component '{$name}' is forbidden for action '" . $this->getAction() . "'.");
         }
     }
     return parent::createComponent($name);
 }
开发者ID:patrickkusebauch,项目名称:nette-security-annotation,代码行数:15,代码来源:SecurePresenterAbstract.php

示例5: createComponent

 protected function createComponent($name)
 {
     if (substr($name, -4) === 'Form') {
         $formClass = 'App\\Controls\\Forms\\' . ucFirst(substr($name, 0, -4));
         if (class_exists($formClass)) {
             return $this->context->createInstance(FormControl::class, [$formClass]);
         }
     } else {
         $controlClass = 'App\\Controls\\' . ucFirst($name);
         if (class_exists($controlClass)) {
             return $this->context->createInstance($controlClass);
         }
     }
     return parent::createComponent($name);
 }
开发者ID:Onset,项目名称:MangoPress,代码行数:15,代码来源:Presenter.php

示例6: createComponent

 /**
  * @author  Jiří Šifalda
  * @param string
  * @return \Nette\Application\UI\Multiplier|\Nette\ComponentModel\IComponent
  */
 protected function createComponent($name)
 {
     $method = 'createComponent' . ucfirst($name);
     if (method_exists($this, $method)) {
         $this->checkRequirements($this->getReflection()->getMethod($method));
         if (\Nette\Reflection\Method::from($this, $method)->hasAnnotation('multiple')) {
             $presenter = $this;
             return new \Nette\Application\UI\Multiplier(function ($id) use($presenter, $method) {
                 $defaultArgs = array($presenter, $id);
                 return call_user_func_array(array($presenter, $method), $defaultArgs);
             });
             # in PHP 5.4 factory for multiplied component can be protected
             # return new UI\Multiplier(function ($id) use ($name) {
             #	return $this->$method($this, $id, $this->getDataset($name));
             # });
         }
     }
     return parent::createComponent($name);
 }
开发者ID:jedenweb,项目名称:framework,代码行数:24,代码来源:Presenter.php

示例7: createComponent

 protected function createComponent($name)
 {
     $ucname = ucfirst($name);
     $method = 'createComponent' . $ucname;
     $presenterReflection = $this->getReflection();
     if ($presenterReflection->hasMethod($method)) {
         $methodReflection = $presenterReflection->getMethod($method);
         $this->checkRequirements($methodReflection);
         if ($methodReflection->hasAnnotation('Actions')) {
             $actions = explode(',', $methodReflection->getAnnotation('Actions'));
             foreach ($actions as $key => $action) {
                 $actions[$key] = trim($action);
             }
             if (!empty($actions) and !in_array($this->getAction(), $actions)) {
                 throw new Nette\Application\ForbiddenRequestException("Creation of component '{$name}' is forbidden for action '{$this->action}'.");
             }
         }
     }
     return parent::createComponent($name);
 }
开发者ID:blitzik,项目名称:vycetky-doctrine,代码行数:20,代码来源:SecurityPresenter.php

示例8: createComponent

 /**
  * Component factory. Delegates the creation of components to a createComponent<Name> method.
  *
  * @param  string      component name
  * @return IComponent  the created component (optionally)
  */
 protected function createComponent($name)
 {
     // parent
     if (($control = parent::createComponent($name)) == TRUE) {
         return $control;
     }
     // widget from widgetManager
     if ($this->widgetManager->hasWidget($name)) {
         return $this->widgetManager->getWidget($name)->invoke();
     }
     throw new \Nette\InvalidArgumentException("Component or widget with name '{$name}' does not exist.");
 }
开发者ID:svobodni,项目名称:web,代码行数:18,代码来源:Presenter.php

示例9: createComponent

	/**
	 * Component factory. Delegates the creation of components to a createComponent<Name> method.
	 * @param  string
	 * @return \Nette\ComponentModel\IComponent
	 */
	protected function createComponent($name)
	{
		$container = $this->getContext()->components;
		if ($container->hasComponent($name)) {
			return $container->getComponent($name, $this);
		}

		return parent::createComponent($name);
	}
开发者ID:norbe,项目名称:framework,代码行数:14,代码来源:Presenter.php


注:本文中的Nette\Application\UI\Presenter::createComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。