You are here

public function AutoEntityLabelManager::autoLabelNeeded in Automatic Entity Label 8.2

Same name and namespace in other branches
  1. 8.3 src/AutoEntityLabelManager.php \Drupal\auto_entitylabel\AutoEntityLabelManager::autoLabelNeeded()
  2. 8 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 175

Class

AutoEntityLabelManager
Class for Auto Entity Label Manager.

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);
}