You are here

public function AutoEntityLabelManager::autoLabelNeeded in Automatic Entity Label 8

Same name and namespace in other branches
  1. 8.3 src/AutoEntityLabelManager.php \Drupal\auto_entitylabel\AutoEntityLabelManager::autoLabelNeeded()
  2. 8.2 src/AutoEntityLabelManager.php \Drupal\auto_entitylabel\AutoEntityLabelManager::autoLabelNeeded()

Returns whether the automatic label has to be set.

Return value

bool Returns true if the label should be automatically generated.

Overrides AutoEntityLabelManagerInterface::autoLabelNeeded

File

src/AutoEntityLabelManager.php, line 171

Class

AutoEntityLabelManager
AutoEntityLabelManager class.

Namespace

Drupal\auto_entitylabel

Code

public function autoLabelNeeded() {
  $not_applied = empty($this->auto_label_applied);
  $required = $this
    ->hasAutoLabel();
  $optional = $this
    ->hasOptionalAutoLabel() && empty($this->entity
    ->label());
  return $not_applied && ($required || $optional);
}