protected function FarmFieldFactory::modifyGeofieldField in farmOS 2.x
Geofield field modifier.
Parameters
\Drupal\Core\Field\BaseFieldDefinition &$field: A base field definition object.
array $options: An array of options.
1 call to FarmFieldFactory::modifyGeofieldField()
- FarmFieldFactory::buildFieldDefinition in modules/
core/ field/ src/ FarmFieldFactory.php - Builds a field definition with farmOS opinions.
File
- modules/
core/ field/ src/ FarmFieldFactory.php, line 656
Class
- FarmFieldFactory
- Factory for generating farmOS field definitions.
Namespace
Drupal\farm_fieldCode
protected function modifyGeofieldField(BaseFieldDefinition &$field, array $options = []) {
// Set the geofield backend.
$field
->setSetting('backend', 'geofield_backend_default');
// Build form and view display settings.
$field
->setDisplayOptions('form', [
'type' => 'farm_map_geofield',
'weight' => $options['weight']['form'] ?? 0,
'settings' => [
'populate_file_field' => $options['populate_file_field'] ?? FALSE,
],
]);
$field
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'farm_map_geofield',
'settings' => [
'output_format' => 'wkt',
'output_escape' => TRUE,
],
'weight' => $options['weight']['view'] ?? 0,
]);
}