public function EntityType::setLabelCallback in Drupal 8
Sets the label callback.
Parameters
callable $callback: A callable that returns the label of the entity.
Return value
$this
Overrides EntityTypeInterface::setLabelCallback
Deprecated
in drupal:8.0.0 and is removed from drupal:9.0.0. Override the EntityInterface::label() method instead for dynamic labels.
See also
\Drupal\Core\Entity\EntityInterface::label()
\Drupal\Core\Entity\EntityTypeInterface::getLabelCallback()
\Drupal\Core\Entity\EntityTypeInterface::hasLabelCallback()
File
- core/
lib/ Drupal/ Core/ Entity/ EntityType.php, line 676
Class
- EntityType
- Provides an implementation of an entity type and its metadata.
Namespace
Drupal\Core\EntityCode
public function setLabelCallback($callback) {
@trigger_error('EntityType::setLabelCallback() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Override the EntityInterface::label() method instead for dynamic labels. See https://www.drupal.org/node/3050794', E_USER_DEPRECATED);
$this->label_callback = $callback;
return $this;
}