You are here

public function ContentHubEntitiesTracking::setAutoUpdate in Acquia Content Hub 8

Sets the entity to auto-update.

Parameters

bool $auto_update: TRUE if set to auto update, FALSE otherwise.

Return value

\Drupal\acquia_contenthub\ContentHubEntitiesTracking This ContentHubEntitiesTracking object.

File

src/ContentHubEntitiesTracking.php, line 458

Class

ContentHubEntitiesTracking
Tracks in a table the list of all entities imported from Content Hub.

Namespace

Drupal\acquia_contenthub

Code

public function setAutoUpdate($auto_update = TRUE) {

  // Case 1: If current state is already "has local change" or "pending
  // update" and we are to set "no auto update", don't set anything. This is
  // because "no auto update" is already implied by current status.
  if ($this
    ->hasLocalChange() && !$auto_update) {
    return $this;
  }

  // All other cases: set as instructed.
  $auto_update_value = $auto_update ? self::AUTO_UPDATE_ENABLED : self::AUTO_UPDATE_DISABLED;
  $this
    ->setImportStatus($auto_update_value);
  return $this;
}