Geometry.php in Geocoder 8.2
File
modules/geocoder_geofield/src/Plugin/Geocoder/Dumper/Geometry.php
View source
<?php
namespace Drupal\geocoder_geofield\Plugin\Geocoder\Dumper;
use Drupal\geocoder\Plugin\Geocoder\Dumper\GeoJson;
use Drupal\geofield\GeoPHP\GeoPHPInterface;
use Geocoder\Model\Address;
use Symfony\Component\DependencyInjection\ContainerInterface;
class Geometry extends GeoJson {
protected $geophp;
public function __construct(array $configuration, $plugin_id, $plugin_definition, GeoPHPInterface $geophp) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->geophp = $geophp;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('geofield.geophp'));
}
public function dump(Address $address) {
return json_encode($this->geophp
->load(parent::dump($address), 'json'));
}
}
Classes
Name |
Description |
Geometry |
Provides a Geometry geocoder dumper plugin. |