public function BackgroundImage::getTypeLabel in Background Image 8
Same name and namespace in other branches
- 2.x src/Entity/BackgroundImage.php \Drupal\background_image\Entity\BackgroundImage::getTypeLabel()
- 2.0.x src/Entity/BackgroundImage.php \Drupal\background_image\Entity\BackgroundImage::getTypeLabel()
The type label.
Parameters
bool $link: Whether or not to link to the target entity, if one exists.
Return value
\Drupal\Component\Render\MarkupInterface|string
Overrides BackgroundImageInterface::getTypeLabel
File
- src/
Entity/ BackgroundImage.php, line 571
Class
- BackgroundImage
- Defines the Background Image entity.
Namespace
Drupal\background_image\EntityCode
public function getTypeLabel($link = FALSE) {
if (!isset($type)) {
$type = $this
->getType();
}
$types = self::getTypes();
if (!isset($types[$type])) {
return $this
->t('Unknown');
}
if ($label = $this
->label($link)) {
if ($type === self::TYPE_ENTITY || $type === self::TYPE_ENTITY_BUNDLE || $type === self::TYPE_VIEW) {
return $label;
}
return new FormattableMarkup('@type: @label', [
'@type' => $types[$type],
'@label' => $label,
]);
}
return $types[$type];
}