public function Field::getPrefixedLabel in Search API 8
Retrieves this field's label along with datasource prefix.
Returns a value similar to getLabel(), but also contains the datasource label, if applicable.
Return value
string A human-readable label representing this field's property path and datasource.
Overrides FieldInterface::getPrefixedLabel
File
- src/
Item/ Field.php, line 429
Class
- Field
- Represents a field on a search item that can be indexed.
Namespace
Drupal\search_api\ItemCode
public function getPrefixedLabel() {
if (!isset($this->labelPrefix)) {
$this->labelPrefix = '';
if (isset($this->datasourceId)) {
$this->labelPrefix = $this->datasourceId;
try {
$this->labelPrefix = $this
->getDatasource()
->label();
} catch (SearchApiException $e) {
$this
->logException($e);
}
$this->labelPrefix .= ' » ';
}
}
return $this->labelPrefix . $this
->getLabel();
}