* zin: refactor
This commit is contained in:
@@ -39,6 +39,13 @@ class h extends wg
|
||||
return array($this->buildTagBegin(), parent::build(), $this->buildTagEnd());
|
||||
}
|
||||
|
||||
protected function toJsonData()
|
||||
{
|
||||
$data = parent::toJsonData();
|
||||
$data['type'] = 'h:' . $this->getTagName();
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getPropsStr()
|
||||
{
|
||||
$skipProps = array_keys(static::getDefinedProps());
|
||||
|
||||
@@ -166,8 +166,8 @@ class props extends \zin\utils\dataset
|
||||
public function toJsonData()
|
||||
{
|
||||
$data = $this->data;
|
||||
$data['style'] = $this->style->data;
|
||||
$data['class'] = $this->class->toStr();
|
||||
if(!empty($this->style->data)) $data['style'] = $this->style->data;
|
||||
if(!empty($this->class->list)) $data['class'] = $this->class->toStr();
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
+13
-3
@@ -27,8 +27,6 @@ class wg
|
||||
|
||||
protected static $defineBlocks = NULL;
|
||||
|
||||
private static $definedPropsMap = array();
|
||||
|
||||
/**
|
||||
* The props of the element
|
||||
*
|
||||
@@ -270,9 +268,19 @@ class wg
|
||||
$value[$index] = $child->toJsonData();
|
||||
}
|
||||
}
|
||||
$data['blocks'][$key] = $value;
|
||||
if($key === 'children')
|
||||
{
|
||||
unset($data['blocks'][$key]);
|
||||
$data['children'] = $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['blocks'][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($data['blocks'])) unset($data['blocks']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -287,6 +295,8 @@ class wg
|
||||
return $defaultProps;
|
||||
}
|
||||
|
||||
private static $definedPropsMap = array();
|
||||
|
||||
protected static function getDefinedProps()
|
||||
{
|
||||
$name = get_called_class();
|
||||
|
||||
Reference in New Issue
Block a user