本文整理匯總了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();
}
}