mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-15 20:09:44 +00:00
DAT-2961 check if parser output exists before using
This commit is contained in:
parent
f197b3e2ea
commit
530b4ca61d
|
@ -28,10 +28,12 @@ class PortableInfoboxDataService {
|
|||
*/
|
||||
public function getData() {
|
||||
if ( $this->title && $this->title->exists() ) {
|
||||
$data = Article::newFromTitle( $this->title, RequestContext::getMain() )
|
||||
$parserOutput = Article::newFromTitle( $this->title, RequestContext::getMain() )
|
||||
//on empty parser cache this should be regenerated, see WikiPage.php:2996
|
||||
->getParserOutput()
|
||||
->getProperty( PortableInfoboxParserTagController::INFOBOXES_PROPERTY_NAME );
|
||||
->getParserOutput();
|
||||
$data = $parserOutput ?
|
||||
$parserOutput->getProperty( PortableInfoboxParserTagController::INFOBOXES_PROPERTY_NAME )
|
||||
: false;
|
||||
|
||||
//return empty [] to prevent false on non existing infobox data
|
||||
return $data ? $data : [ ];
|
||||
|
|
Loading…
Reference in a new issue