You are here

public function LingotekContentModerationSettingsForm::getDefaultModerationDownloadTransition in Lingotek Translation 3.2.x

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

Gets the default transition.

Parameters

string $entity_type_id: The entity type id.

string $bundle: The bundle id.

Return value

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

Overrides LingotekModerationSettingsFormInterface::getDefaultModerationDownloadTransition

1 call to LingotekContentModerationSettingsForm::getDefaultModerationDownloadTransition()
LingotekContentModerationSettingsForm::form in src/Moderation/LingotekContentModerationSettingsForm.php
Gets the subform for configuring the settings for a given bundle.

File

src/Moderation/LingotekContentModerationSettingsForm.php, line 227

Class

LingotekContentModerationSettingsForm
Moderation settings form for the Lingotek content_moderation integration.

Namespace

Drupal\lingotek\Moderation

Code

public function getDefaultModerationDownloadTransition($entity_type_id, $bundle) {
  $transition = $this->moderationConfiguration
    ->getDownloadTransition($entity_type_id, $bundle);
  if (!$transition) {
    $workflow = $this
      ->getWorkflow($entity_type_id, $bundle);
    $transitions = $workflow
      ->getTypePlugin()
      ->getTransitionsForState($this
      ->getDefaultModerationUploadStatus($entity_type_id, $bundle));
    if (count($transitions) > 0) {

      /** @var \Drupal\workflows\TransitionInterface $potential_transition */
      foreach ($transitions as $transition_id => $potential_transition) {
        $toState = $potential_transition
          ->to();
        if ($toState
          ->isPublishedState()) {
          $transition = $transition_id;
          break;
        }
      }
    }
  }
  return $transition;
}