public function load($row, array $info = array()) { $gen = Kwf_Component_Generator_Abstract::getInstance($this->_componentClass, $this->_generatorKey); $edit = Kwf_Component_Abstract_ExtConfig_Abstract::getEditConfigs($this->_getComponentClassByRow($row), $gen, '{componentId}-{0}', ''); $this->_componentConfigs = array_merge($this->_componentConfigs, $edit['componentConfigs']); $ret = $edit['contentEditComponents']; $g = Kwc_Abstract::getSetting($this->_componentClass, 'generators'); if (isset($g['detail']['dbIdShortcut'])) { $dbId = $g['detail']['dbIdShortcut'] . $row->id; } else { $dbId = $row->component_id . $gen->getIdSeparator() . $row->id; } $components = Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($dbId, array('ignoreVisible' => true)); if (isset($components[0])) { foreach (Kwf_Controller_Action_Component_PagesController::getSharedComponents($components[0]) as $cls => $cmp) { $cfg = Kwc_Admin::getInstance($cls)->getExtConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_SHARED); foreach ($cfg as $k => $c) { if (!isset($this->_componentConfigs[$cls . '-' . $k])) { $this->_componentConfigs[$cls . '-' . $k] = $c; } $ret[] = array('componentClass' => $cls, 'type' => $k, 'idTemplate' => '{componentId}-{0}', 'componentIdSuffix' => ''); } } } return $ret; }
public function testIt() { $root = $this->_root; $component = $root->getComponentById('root_2-shared'); $sharedComponents = Kwf_Controller_Action_Component_PagesController::getSharedComponents($root); $expected = array($component->componentClass => $root); $this->assertEquals($expected, $sharedComponents); $row = $component->getComponent()->getRow(); $this->assertEquals('root', $row->component_id); $this->assertEquals('foo', $row->text); }