當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。