本文整理汇总了PHP中Presenter::createComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Presenter::createComponent方法的具体用法?PHP Presenter::createComponent怎么用?PHP Presenter::createComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Presenter
的用法示例。
在下文中一共展示了Presenter::createComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createComponent
public function createComponent($name)
{
switch ($name) {
case 'searchForm':
$form = new AppForm($this, $name);
$form->addText('q', __('Query:'));
$form['q']->getControlPrototype()->onclick('if (this.value === "' . __('Input search keywords') . '") {
this._default = this.value;
this.value = "";
}');
$form['q']->getControlPrototype()->onblur('if (this.value === "" && this._default !== undefined) {
this.value = this._default;
}');
$form->setAction($this->link('Search:default'));
$form->setMethod('get');
if (isset(Environment::getSession(SESSION_SEARCH_NS)->last)) {
$form->setDefaults(array('q' => Environment::getSession(SESSION_SEARCH_NS)->last));
} else {
$form->setDefaults(array('q' => __('Input search keywords')));
}
break;
default:
return parent::createComponent($name);
}
}
示例2: createComponent
protected function createComponent($name)
{
$plugins = $this->context->plugins->getPlugins();
if (in_array($name, $plugins)) {
return new $name();
}
return parent::createComponent($name);
}
示例3: createComponent
public function createComponent($name)
{
switch ($name) {
case 'loginForm':
$form = new AppForm($this, $name);
$form->addText('username', __('Username:'));
$form->addPassword('password', __('Password:'));
$form->addSubmit('ok', __('Login'));
$form->onSubmit[] = array($this, 'onLoginFormSubmit');
break;
default:
return parent::createComponent($name);
}
}