本文整理汇总了PHP中Nette\Application\UI\Control::createComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Control::createComponent方法的具体用法?PHP Control::createComponent怎么用?PHP Control::createComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Control
的用法示例。
在下文中一共展示了Control::createComponent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: createComponent
protected function createComponent($name)
{
if (isset($this->controlFactories[$name])) {
$controlFactory = $this->controlFactories[$name];
return $controlFactory->create();
}
return parent::createComponent($name);
}
示例3: createComponent
/**
* @param string
* @return \Nette\ComponentModel\IComponent
*/
protected function createComponent($name)
{
$method = 'createComponent' . ucfirst($name);
if (method_exists($this, $method)) {
$this->checkRequirements($this->getReflection()->getMethod($method));
}
return parent::createComponent($name);
}
示例4: 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->presenter->widgetManager->hasWidget($name)) {
return $this->presenter->widgetManager->getWidget($name)->invoke();
}
throw new \Nette\InvalidArgumentException("Component or widget with name '{$name}' does not exist.");
}
示例5: 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);
}
示例6: createComponent
/**
* @param string $name
* @return \Nette\ComponentModel\IComponent
*/
protected function createComponent($name)
{
$this->load();
return parent::createComponent($name);
}
示例7: createComponent
protected function createComponent($name) : Nette\ComponentModel\IComponent
{
return parent::createComponent($name) ?: $this->getPresenter()->createComponent($name);
}
示例8: createComponent
/**
* Creates Component
*
* priority: props, $this->componentFactory(), createComponent<Name> methods
* @param string component name
* @return IComponent the created component (optionally)
*/
protected final function createComponent($name)
{
if ($this->props->hasProp('onComponentCreate')) {
$component = $this->props->onComponentCreate($this, $name);
if ($component) {
return $component;
}
}
$component = $this->onComponentCreate($this, $name);
if ($component) {
return $component;
}
$component = parent::createComponent($name);
if ($component) {
return $component;
}
//stub control
$props = new Props();
$props->templatePath = __DIR__ . '/templates/no-control.latte';
/*$props->onRender = function (RaControl $control) {
if ($control->getParent() instanceOf StubControl) {
$control->getParent()->render();
return false;
}
return true; //continue rendering
};*/
return new StubControl($props);
}
示例9: createComponent
protected function createComponent($name)
{
$control = parent::createComponent($name);
$this->prepareComponent($name, $control);
return $control;
}