mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-16 12:35:31 +00:00
28 lines
753 B
PHP
28 lines
753 B
PHP
<?php
|
|
namespace Wikia\PortableInfobox\Parser\Nodes;
|
|
|
|
use Wikia\PortableInfobox\Parser\XmlParser;
|
|
|
|
class NodeGroup extends Node {
|
|
const DATA_LAYOUT_ATTR_NAME = 'layout';
|
|
|
|
public function getData() {
|
|
$nodeFactory = new XmlParser( $this->infoboxData );
|
|
if ( $this->externalParser ) {
|
|
$nodeFactory->setExternalParser( $this->externalParser );
|
|
}
|
|
$layout = $this->getXmlAttribute( $this->xmlNode, self::DATA_LAYOUT_ATTR_NAME );
|
|
$value = $nodeFactory->getDataFromNodes( $this->xmlNode, $this );
|
|
return [ 'value' => $value, 'layout' => $layout ];
|
|
}
|
|
|
|
public function isEmpty( $data ) {
|
|
foreach ( $data[ 'value' ] as $elem ) {
|
|
if ( $elem[ 'type' ] != 'header' && !( $elem[ 'isEmpty' ] ) ) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
}
|