public static function initPeer(self $action, $key = null, array $params = array()) { if (is_null($key)) { $key = '_' . substr(md5(microtime()), rand(0, 27), 5); } return sprintf("t41.view.register('%s', new %s(%s,%s))", $key, $action->_jspeer, \Zend_Json::encode($action->reduce()), \Zend_Json::encode($params)); }
public function reduce(array $params = array()) { $this->_context = array_merge($this->_context, array('minChars' => self::$minChars, 'displayMode' => self::$displayMode, 'defaultSelect' => self::$defaultSelect, 'latency' => self::$latency, 'cachePrefix' => 'ac_' . $this->_obj->getCachePrefix())); $array = parent::reduce($params); $array['data']['display'] = $this->getDisplay(); $array['data']['sdisplay'] = $this->getSearchDisplay(); return $array; }