protected function _getObject() { $column = $this->_getColumn(); $object = $column->editor; if (empty($object)) { $object = Ext_Factory::object('Form_Field_Text'); $object->setName(parent::_getObject()->getName() . '_' . $column->getName() . '_editor'); $column->editor = $object; $this->_storeProject(); } return $object; }
/** * Change field type */ public function changetypeAction() { $this->_checkLoaded(); $object = $this->_getObject(); $type = Request::post('type', 'string', false); $adapter = Request::post('adapter', 'string', false); $dictionary = Request::post('dictionary', 'string', false); if ($type === 'Form_Field_Adapter') { $newObject = Ext_Factory::object($adapter); /* * Invalid adapter */ if (!$adapter || !strlen($adapter) || !class_exists($adapter)) { Response::jsonError($this->_lang->INVALID_VALUE, array('adapter' => $this->_lang->INVALID_VALUE)); } if ($adapter === 'Ext_Component_Field_System_Dictionary') { /* * Inavalid dictionary */ if (!$dictionary || !strlen($dictionary)) { Response::jsonError($this->_lang->INVALID_VALUE, array('dictionary' => $this->_lang->INVALID_VALUE)); } $newObject->dictionary = $dictionary; } } else { $newObject = Ext_Factory::object($type); /* * No changes */ if ($type === $object->getClass()) { Response::jsonSuccess(); } } Ext_Factory::copyProperties($object, $newObject); $newObject->setName($object->getName()); parent::_getObject()->setViewObject($newObject); $this->_storeProject(); Response::jsonSuccess(); }