PortableInfobox/services/Parser/Nodes/NodeGroup.php

25 lines
588 B
PHP

<?php
namespace Wikia\PortableInfobox\Parser\Nodes;
use Wikia\PortableInfobox\Parser\XmlParser;
class NodeGroup extends Node {
public function getData() {
$nodeFactory = new XmlParser( $this->infoboxData );
if ( $this->externalParser ) {
$nodeFactory->setExternalParser( $this->externalParser );
}
return [ 'value' => $nodeFactory->getDataFromNodes( $this->xmlNode, $this ) ];
}
public function isEmpty( $data ) {
foreach ( $data[ 'value' ] as $elem ) {
if ( $elem[ 'type' ] != 'header' && !( $elem[ 'isEmpty' ] ) ) {
return false;
}
}
return true;
}
}