本文整理汇总了PHP中Component::setParent方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::setParent方法的具体用法?PHP Component::setParent怎么用?PHP Component::setParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component::setParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setParent
/**
* Overloaded parent setter. This method checks for invalid control name.
* @param IComponentContainer
* @param string
* @return void
*/
public function setParent(IComponentContainer $parent = NULL, $name = NULL)
{
if ($name === 'submit') {
throw new InvalidArgumentException("Name 'submit' is not allowed due to JavaScript limitations.");
}
parent::setParent($parent, $name);
}
示例2: addChild
public function addChild(Component $component)
{
$parentClass = get_class($this);
if (get_class($this) == "HtmlComponent") {
$parentClass = $this->getTagName();
}
$this->children[] = $component;
$component->setParent($this);
}
示例3: addChild
/**
* Adiciona um componente como filho desse componente.
* @param Component $child O filho que será adicionado.
* @return Component O filho recém adicionado.
* @throws LogicException Se o componente já for filho de outro pai.
*/
public function addChild(Component $child)
{
$this->children[$child->hashCode()] = $child;
return $child->setParent($this);
}
示例4: onComponentAdded
protected function onComponentAdded(Component &$component)
{
$component->setParent($this);
$page = $this->getPage();
if ($page != null) {
if ($page->isInitialized()) {
$component->internalInitialize();
}
}
if ($this->isBeforePageRender()) {
$component->beforePageRender();
}
}