You are here

public function GeofieldBaseWidget::__construct in Geofield 8

GeofieldBaseWidget constructor.

Parameters

string $plugin_id: The plugin_id for the formatter.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The definition of the field to which the formatter is associated.

array $settings: The formatter settings.

array $third_party_settings: Any third party settings settings.

\Drupal\geofield\GeoPHP\GeoPHPInterface $geophp_wrapper: The geoPhpWrapper.

\Drupal\geofield\WktGeneratorInterface $wkt_generator: The WKT format Generator service.

\Drupal\geofield\Plugin\GeofieldBackendManager $geofield_backend_manager: The geofieldBackendManager.

Overrides WidgetBase::__construct

File

src/Plugin/Field/FieldWidget/GeofieldBaseWidget.php, line 60

Class

GeofieldBaseWidget
Abstract class for Geofield widgets.

Namespace

Drupal\geofield\Plugin\Field\FieldWidget

Code

public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, GeoPHPInterface $geophp_wrapper, WktGeneratorInterface $wkt_generator, GeofieldBackendManager $geofield_backend_manager = NULL) {
  parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
  try {
    if ($geofield_backend_manager instanceof GeofieldBackendManager) {
      $this->geofieldBackend = $geofield_backend_manager
        ->createInstance($field_definition
        ->getSetting("backend"));
    }
  } catch (PluginException $e) {
    watchdog_exception("geofield base widget", $e);
  }
  $this->geoPhpWrapper = $geophp_wrapper;
  $this->wktGenerator = $wkt_generator;
}