Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue 756 geoJson namespace error #757

22 changes: 14 additions & 8 deletions src/GeoJsonPages/GeoJsonContentHandler.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

/**
* @reviewer thomas-topway-it for KM-A
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not add author or reviewer tags in this repo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed


declare( strict_types = 1 );

namespace Maps\GeoJsonPages;
Expand Down Expand Up @@ -35,18 +39,20 @@ protected function fillParserOutput(
) {
'@phan-var GeoJsonContent $content';

if ( !$cpoParams->getGenerateHtml() || !$content->isValid() ) {
$parserOutput->setText( '' );
return;
}
parent::fillParserOutput( $content, $cpoParams, $parserOutput );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add this call?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to set the correct parserOutput text by calling the same method in the parent class (JsonContentHandler)


if ( $cpoParams->getGenerateHtml()
&& $content->isValid()
&& MapsFactory::globalInstance()->smwIntegrationIsEnabled()
&& $parserOutput->hasText() ) {

GeoJsonMapPageUi::forExistingPage( $content->beautifyJSON() )
->addToOutput( OutputFacade::newFromParserOutput( $parserOutput ) );
// @FIXME alternatively decode $this->mText in GeoJsonLegacyContent
// to avoid decoding it again in SubObjectBuilder -> getSubObjectsFromGeoJson
$text = json_encode( $content->getData()->getValue() );

if ( MapsFactory::globalInstance()->smwIntegrationIsEnabled() && $parserOutput->hasText() ) {
MapsFactory::globalInstance()
->newSemanticGeoJsonStore( $parserOutput, $cpoParams->getPage() )
->storeGeoJson( $parserOutput->getRawText() );
->storeGeoJson( $text );
}
}
}
Loading