/
Component.php
46 lines (42 loc) · 1.41 KB
/
Component.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
class Kwc_Abstract_Composite_Component extends Kwc_Abstract
{
public static function getSettings($param = null)
{
$ret = parent::getSettings($param);
$ret['assetsAdmin']['dep'][] = 'KwfTabPanel';
$ret['generators']['child'] = array(
'class' => 'Kwf_Component_Generator_Static',
'component' => array()
);
$ret['extConfig'] = 'Kwc_Abstract_Composite_ExtConfigForm';
return $ret;
}
public function hasContent()
{
foreach ($this->getData()->getChildComponents(array('generator' => 'child')) as $c) {
if ($c->hasContent()) return true;
}
return false;
}
public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
{
$ret = parent::getTemplateVars($renderer);
$ret['keys'] = array();
foreach ($this->getData()->getChildComponents(array('generator' => 'child')) as $c) {
$ret[$c->id] = $c;
$ret['keys'][] = $c->id;
}
return $ret;
}
public function getExportData()
{
$children = $this->getData()->getChildComponents(array('generator' => 'child'));
if (!count($children)) return array();
$ret = array('composite' => array());
foreach ($children as $child) {
$ret['composite'][$child->id] = $child->getComponent()->getExportData();
}
return $ret;
}
}