PortableInfobox/services/Parser/Nodes/NodeGroup.php

29 lines
780 B
PHP
Raw Normal View History

<?php
namespace Wikia\PortableInfobox\Parser\Nodes;
use Wikia\PortableInfobox\Parser\XmlParser;
class NodeGroup extends Node {
2015-06-09 08:16:47 +00:00
const DATA_THEME_ATTR_NAME = 'theme';
public function getData() {
$nodeFactory = new XmlParser( $this->infoboxData );
if ( $this->externalParser ) {
$nodeFactory->setExternalParser( $this->externalParser );
}
2015-06-09 08:16:47 +00:00
$theme = $this->getXmlAttribute( $this->xmlNode, self::DATA_THEME_ATTR_NAME );
$value = $nodeFactory->getDataFromNodes( $this->xmlNode, $this );
//var_dump("theme: ", $theme);
return [ 'value' => $value, 'theme' => $theme ];
}
public function isEmpty( $data ) {
foreach ( $data[ 'value' ] as $elem ) {
if ( $elem[ 'type' ] != 'header' && !( $elem[ 'isEmpty' ] ) ) {
return false;
}
}
return true;
}
}