protected function CmisFieldLink::viewValue in CMIS API 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldFormatter/CmisFieldLink.php \Drupal\cmis\Plugin\Field\FieldFormatter\CmisFieldLink::viewValue()
- 3.0.x src/Plugin/Field/FieldFormatter/CmisFieldLink.php \Drupal\cmis\Plugin\Field\FieldFormatter\CmisFieldLink::viewValue()
Generate the output appropriate for one field item.
Parameters
\Drupal\Core\Field\FieldItemInterface $item: One field item.
Return value
string The textual output generated.
1 call to CmisFieldLink::viewValue()
- CmisFieldLink::viewElements in src/
Plugin/ Field/ FieldFormatter/ CmisFieldLink.php - Builds a renderable array for a field value.
File
- src/
Plugin/ Field/ FieldFormatter/ CmisFieldLink.php, line 74
Class
- CmisFieldLink
- Plugin implementation of the 'cmis_field_link' formatter.
Namespace
Drupal\cmis\Plugin\Field\FieldFormatterCode
protected function viewValue(FieldItemInterface $item) {
$url = \Drupal\Core\Url::fromUserInput($item
->get('path')
->getValue());
if (empty($url)) {
return [];
}
$path = \Drupal\Core\Link::fromTextAndUrl($item
->get('title')
->getValue(), $url)
->toRenderable();
return $path;
}