protected function ColorboxFieldFormatter::getUrl in Colorbox field formatter 8
Same name and namespace in other branches
- 2.0.x src/Plugin/Field/FieldFormatter/ColorboxFieldFormatter.php \Drupal\colorbox_field_formatter\Plugin\Field\FieldFormatter\ColorboxFieldFormatter::getUrl()
Parameters
\Drupal\Core\Field\FieldItemInterface $item: One field item.
Return value
Throws
\Drupal\Core\Entity\EntityMalformedException
1 call to ColorboxFieldFormatter::getUrl()
- ColorboxFieldFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ ColorboxFieldFormatter.php
1 method overrides ColorboxFieldFormatter::getUrl()
- ColorboxFieldFormatterEntityreference::getUrl in src/
Plugin/ Field/ FieldFormatter/ ColorboxFieldFormatterEntityreference.php
File
- src/
Plugin/ Field/ FieldFormatter/ ColorboxFieldFormatter.php, line 318
Class
- ColorboxFieldFormatter
- Plugin implementation of the 'colorbox_field_formatter' formatter.
Namespace
Drupal\colorbox_field_formatter\Plugin\Field\FieldFormatterCode
protected function getUrl(FieldItemInterface $item) : Url {
$entity = $item
->getEntity();
if ($this
->getSetting('link_type') === 'content') {
return $entity
->toUrl();
}
$link = $this
->getSetting('link');
if ($this->moduleHandler
->moduleExists('token')) {
$link = $this->token
->replace($this
->getSetting('link'), [
$entity
->bundle() => $entity,
], [
'clear' => TRUE,
]);
}
return Url::fromUserInput($link);
}