private static function LinkField::getEntityLabels in Conditional Fields 4.x
Same name and namespace in other branches
- 8 src/Plugin/conditional_fields/handler/LinkField.php \Drupal\conditional_fields\Plugin\conditional_fields\handler\LinkField::getEntityLabels()
Returns an array with relevant values for autocomplete in different format.
Parameters
object $entity: The entity object.
Return value
array Relevant values for autocomplete, eg.
- Node title
- Node title (1)
- /node/1
1 call to LinkField::getEntityLabels()
- LinkField::getUriAsDisplayableString in src/
Plugin/ conditional_fields/ handler/ LinkField.php - Gets the URI without the 'internal:' or 'entity:' scheme.
File
- src/
Plugin/ conditional_fields/ handler/ LinkField.php, line 124
Class
- LinkField
- Provides states handler for links provided by the Link module.
Namespace
Drupal\conditional_fields\Plugin\conditional_fields\handlerCode
private static function getEntityLabels($entity) {
// Use the special view label, since some entities allow the label to be
// viewed, even if the entity is not allowed to be viewed.
$title = $entity
->label();
// Labels containing commas or quotes must be wrapped in quotes.
$title = Tags::encode($title);
$title_nid = $title . ' (' . $entity
->id() . ')';
$result = [
$title,
$title_nid,
'/node/' . $entity
->id(),
];
return $result;
}