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() {
|
2015-05-25 10:25:14 +00:00
|
|
|
$parent = $this->getParent();
|
|
|
|
if ( $parent instanceof NodeSet ) {
|
|
|
|
if ( $parent->getParent() instanceof NodeComparison ) {
|
2015-05-21 16:07:49 +00:00
|
|
|
// 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
|
|
|
}
|
|
|
|
}
|