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