Submit callback for the job item review form.
Overrides SourcePluginUiBase::reviewFormSubmit
public function reviewFormSubmit(array $form, FormStateInterface $form_state, JobItemInterface $item) {
// At this point, we don't need to check whether an entity is moderated or
// publishable. Instead, we look for a specific key that may be set.
if ($form_state
->hasValue([
'moderation_state',
'new_state',
])) {
// We are using a special #moderation_state key to carry the information
// about the new moderation state value.
// See \Drupal\tmgmt_content\Plugin\tmgmt\Source\ContentEntitySource::doSaveTranslations()
$moderation_state = (array) $form_state
->getValue([
'moderation_state',
'new_state',
]);
$item
->updateData([
'#moderation_state',
], $moderation_state, TRUE);
}
elseif ($form_state
->hasValue([
'status',
'published',
])) {
$published = (array) (bool) $form_state
->getValue([
'status',
'published',
]);
$item
->updateData([
'#published',
], $published, TRUE);
}
parent::reviewFormSubmit($form, $form_state, $item);
}