GeocoderBase.php in Geolocation Field 8
File
src/GeocoderBase.php
View source
<?php
namespace Drupal\geolocation;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Config\Config;
abstract class GeocoderBase extends PluginBase implements GeocoderInterface, ContainerFactoryPluginInterface {
protected $geolocationSettings;
public function __construct(array $configuration, $plugin_id, $plugin_definition, Config $config) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->geolocationSettings = $config;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('config.factory')
->get('geolocation.settings'));
}
public function getOptionsForm() {
return [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $this
->t('No settings available.'),
];
}
public function processOptionsForm(array $form_element) {
return NULL;
}
public function formAttachGeocoder(array &$render_array, $element_name) {
return NULL;
}
public function formValidateInput(FormStateInterface $form_state) {
return TRUE;
}
public function formProcessInput(array &$input, $element_name) {
return TRUE;
}
public function geocode($address) {
return NULL;
}
}