2015-04-27 14:05:31 +00:00
|
|
|
<?php
|
|
|
|
namespace Wikia\PortableInfobox\Parser\Nodes;
|
|
|
|
|
2015-05-04 10:48:57 +00:00
|
|
|
class NodeData extends Node {
|
2015-04-27 14:05:31 +00:00
|
|
|
|
2015-05-21 16:07:49 +00:00
|
|
|
public function ignoreNodeWhenEmpty() {
|
|
|
|
if ( $this->isParentTypeOf( NodeSet::type() ) ) {
|
|
|
|
$parent = $this->getParent();
|
|
|
|
if ( $parent->isParentTypeOf( NodeComparison::type() ) ) {
|
|
|
|
// data tag inside comparison tag can not be ignored
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-04-27 14:05:31 +00:00
|
|
|
public function getData() {
|
2015-05-07 12:37:13 +00:00
|
|
|
return [
|
2015-05-19 18:20:44 +00:00
|
|
|
'label' => $this->getExternalParser()->parseRecursive(
|
|
|
|
\Wikia\PortableInfobox\Helpers\SimpleXmlUtil::getInstance()->getInnerXML(
|
|
|
|
$this->xmlNode->{self::LABEL_TAG_NAME}
|
|
|
|
)
|
|
|
|
),
|
2015-05-07 12:37:13 +00:00
|
|
|
'value' => $this->getValueWithDefault( $this->xmlNode )
|
|
|
|
];
|
2015-04-27 14:05:31 +00:00
|
|
|
}
|
|
|
|
}
|