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); } }
protected function createComponent($name) { $plugins = $this->context->plugins->getPlugins(); if (in_array($name, $plugins)) { return new $name(); } return parent::createComponent($name); }
public function createComponent($name) { switch ($name) { case 'loginForm': $form = new AppForm($this, $name); $form->addText('username', __('Username:'******'password', __('Password:'******'ok', __('Login')); $form->onSubmit[] = array($this, 'onLoginFormSubmit'); break; default: return parent::createComponent($name); } }