public function GeolocationFieldProvider::replaceFieldItemTokens in Geolocation Field 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/geolocation/DataProvider/GeolocationFieldProvider.php \Drupal\geolocation\Plugin\geolocation\DataProvider\GeolocationFieldProvider::replaceFieldItemTokens()
Replace field item tokens.
Parameters
string $text: Text.
\Drupal\Core\Field\FieldItemInterface $fieldItem: Field item.
Return value
array Retrieved locations.
Overrides DataProviderBase::replaceFieldItemTokens
File
- src/
Plugin/ geolocation/ DataProvider/ GeolocationFieldProvider.php, line 54
Class
- GeolocationFieldProvider
- Provides default geolocation field.
Namespace
Drupal\geolocation\Plugin\geolocation\DataProviderCode
public function replaceFieldItemTokens($text, FieldItemInterface $fieldItem) {
$token_context['geolocation_current_item'] = $fieldItem;
$text = \Drupal::token()
->replace($text, $token_context, [
'callback' => [
$this,
'geolocationItemTokens',
],
'clear' => FALSE,
]);
return parent::replaceFieldItemTokens($text, $fieldItem);
}