AddressText.php in Geocoder 8.3
File
src/Plugin/Geocoder/Dumper/AddressText.php
View source
<?php
namespace Drupal\geocoder\Plugin\Geocoder\Dumper;
use Drupal\geocoder\DumperBase;
use Geocoder\Location;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\geocoder\FormatterPluginManager;
class AddressText extends DumperBase {
protected $geocoderFormatterPluginManager;
protected $geocoderFormatter;
public function __construct(array $configuration, $plugin_id, $plugin_definition, FormatterPluginManager $geocoder_formatter_plugin_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->geocoderFormatterPluginManager = $geocoder_formatter_plugin_manager;
$this->geocoderFormatter = $this->geocoderFormatterPluginManager
->createInstance('default_formatted_address');
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('plugin.manager.geocoder.formatter'));
}
public function dump(Location $location) {
return $this->geocoderFormatter
->format($location);
}
}
Classes
Name |
Description |
AddressText |
Provides an address string geocoder dumper plugin. |