You are here

public function LingotekContentModerationSettingsForm::getDefaultModerationUploadStatus in Lingotek Translation 3.8.x

Same name and namespace in other branches
  1. 8.2 src/Moderation/LingotekContentModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekContentModerationSettingsForm::getDefaultModerationUploadStatus()
  2. 4.0.x src/Moderation/LingotekContentModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekContentModerationSettingsForm::getDefaultModerationUploadStatus()
  3. 3.0.x src/Moderation/LingotekContentModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekContentModerationSettingsForm::getDefaultModerationUploadStatus()
  4. 3.1.x src/Moderation/LingotekContentModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekContentModerationSettingsForm::getDefaultModerationUploadStatus()
  5. 3.2.x src/Moderation/LingotekContentModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekContentModerationSettingsForm::getDefaultModerationUploadStatus()
  6. 3.3.x src/Moderation/LingotekContentModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekContentModerationSettingsForm::getDefaultModerationUploadStatus()
  7. 3.4.x src/Moderation/LingotekContentModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekContentModerationSettingsForm::getDefaultModerationUploadStatus()
  8. 3.5.x src/Moderation/LingotekContentModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekContentModerationSettingsForm::getDefaultModerationUploadStatus()
  9. 3.6.x src/Moderation/LingotekContentModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekContentModerationSettingsForm::getDefaultModerationUploadStatus()
  10. 3.7.x src/Moderation/LingotekContentModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekContentModerationSettingsForm::getDefaultModerationUploadStatus()

Gets the default upload status.

Parameters

string $entity_type_id: The entity type id.

string $bundle: The bundle id.

Return value

string The default status ID. If there is a setting, that will be returned.

Overrides LingotekModerationSettingsFormInterface::getDefaultModerationUploadStatus

2 calls to LingotekContentModerationSettingsForm::getDefaultModerationUploadStatus()
LingotekContentModerationSettingsForm::form in src/Moderation/LingotekContentModerationSettingsForm.php
Gets the subform for configuring the settings for a given bundle.
LingotekContentModerationSettingsForm::getDefaultModerationDownloadTransition in src/Moderation/LingotekContentModerationSettingsForm.php
Gets the default transition.

File

src/Moderation/LingotekContentModerationSettingsForm.php, line 196

Class

LingotekContentModerationSettingsForm
Moderation settings form for the Lingotek content_moderation integration.

Namespace

Drupal\lingotek\Moderation

Code

public function getDefaultModerationUploadStatus($entity_type_id, $bundle) {
  $status = $this->moderationConfiguration
    ->getUploadStatus($entity_type_id, $bundle);
  if (!$status) {
    $workflow = $this
      ->getWorkflow($entity_type_id, $bundle);
    $states = $workflow
      ->getTypePlugin()
      ->getStates();
    $published_statuses = array_filter($states, function (ContentModerationState $state) {
      return $state
        ->isPublishedState();
    });
    if (count($published_statuses) > 0) {
      $status = reset($published_statuses)
        ->id();
    }
  }
  return $status;
}