protected function EditUpdateForm::getModerationOptions in Scheduled Publish 8.3
Get moderation options.
2 calls to EditUpdateForm::getModerationOptions()
- EditUpdateForm::buildForm in src/
Form/ EditUpdateForm.php - Form constructor.
- EditUpdateForm::handleStates in src/
Form/ EditUpdateForm.php - Handles state values, clean-up and ordering.
File
- src/
Form/ EditUpdateForm.php, line 151 - Contains \Drupal\scheduled_publish\Form\EditUpdateForm.
Class
Namespace
Drupal\scheduled_publish\FormCode
protected function getModerationOptions($entity) {
$states = [];
/** @var \Drupal\content_moderation\ModerationInformation $moderationInformationService */
$moderationInformationService = \Drupal::service('content_moderation.moderation_information');
if ($moderationInformationService
->isModeratedEntity($entity)) {
/** @var \Drupal\content_moderation\StateTransitionValidation $transitionValidationService */
$transitionValidationService = \Drupal::service('content_moderation.state_transition_validation');
$transitions = $transitionValidationService
->getValidTransitions($entity, \Drupal::currentUser());
foreach ($transitions as $key => $value) {
$states[$transitions[$key]
->to()
->id()] = $transitions[$key]
->label();
}
}
return $states;
}