public function LingotekWorkbenchModerationSettingsForm::form in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 8.2 src/Moderation/LingotekWorkbenchModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationSettingsForm::form()
- 4.0.x src/Moderation/LingotekWorkbenchModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationSettingsForm::form()
- 3.1.x src/Moderation/LingotekWorkbenchModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationSettingsForm::form()
- 3.2.x src/Moderation/LingotekWorkbenchModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationSettingsForm::form()
- 3.3.x src/Moderation/LingotekWorkbenchModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationSettingsForm::form()
- 3.4.x src/Moderation/LingotekWorkbenchModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationSettingsForm::form()
- 3.5.x src/Moderation/LingotekWorkbenchModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationSettingsForm::form()
- 3.6.x src/Moderation/LingotekWorkbenchModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationSettingsForm::form()
- 3.8.x src/Moderation/LingotekWorkbenchModerationSettingsForm.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationSettingsForm::form()
Gets the subform for configuring the settings for a given bundle.
Parameters
string $entity_type_id: The entity type id.
string $bundle: The bundle id.
Return value
array The array defining the form.
Overrides LingotekModerationSettingsFormInterface::form
File
- src/
Moderation/ LingotekWorkbenchModerationSettingsForm.php, line 163
Class
- LingotekWorkbenchModerationSettingsForm
- Moderation settings form for the Lingotek workbench_moderation integration.
Namespace
Drupal\lingotek\ModerationCode
public function form($entity_type_id, $bundle) {
// We only add this option if the workbench moderation is enabled.
$entity_type_definition = $this->entityTypeManager
->getDefinition($entity_type_id);
$form = [];
if ($this->moderationInfo
->isModeratableBundle($entity_type_definition, $bundle)) {
$statuses = $this
->getModerationUploadStatuses($entity_type_id, $bundle);
$default_status = $this
->getDefaultModerationUploadStatus($entity_type_id, $bundle);
$transitions = $this
->getModerationDownloadTransitions($entity_type_id, $bundle);
$default_transition = $this
->getDefaultModerationDownloadTransition($entity_type_id, $bundle);
$form['upload_status'] = [
'#type' => 'select',
'#options' => $statuses,
'#default_value' => $default_status,
'#title' => $this
->t('In which status needs to be uploaded?'),
];
$form['download_transition'] = [
'#type' => 'select',
'#options' => $transitions,
'#default_value' => $default_transition,
'#title' => $this
->t('Which transition should be executed after download?'),
];
}
elseif ($this->moderationInfo
->isModeratableEntityType($entity_type_definition)) {
$bundle_type_id = $entity_type_definition
->getBundleEntityType();
$form = [
'#markup' => $this
->t('This entity bundle is not enabled for moderation with workbench_moderation. You can change its settings <a href=":moderation">here</a>.', [
':moderation' => $this->urlGenerator
->generateFromRoute("entity.{$bundle_type_id}.moderation", [
$bundle_type_id => $bundle,
]),
]),
];
}
return $form;
}