'source' => $default_langcode,
'target' => $langcode
], ['language' => $language]);
- $this->drupalPostForm($add_url, $this->getEditValues($values, $langcode), t('Save and unpublish (this translation)'));
+ $edit = $this->getEditValues($values, $langcode);
+ $edit['status[value]'] = FALSE;
+ $this->drupalPostForm($add_url, $edit, t('Save (this translation)'));
$storage->resetCache([$this->entityId]);
$entity = $storage->load($this->entityId);
return ['title' => [['value' => $this->randomMachineName()]]] + parent::getNewEntityValues($langcode);
}
- /**
- * {@inheritdoc}
- */
- protected function getFormSubmitAction(EntityInterface $entity, $langcode) {
- if ($entity->getTranslation($langcode)->isPublished()) {
- return t('Save and keep published') . $this->getFormSubmitSuffix($entity, $langcode);
- }
- else {
- return t('Save and keep unpublished') . $this->getFormSubmitSuffix($entity, $langcode);
- }
- }
-
/**
* {@inheritdoc}
*/
$entity = $storage->load($this->entityId);
$languages = $this->container->get('language_manager')->getLanguages();
- $actions = [
- t('Save and keep published'),
- t('Save and unpublish'),
+ $statuses = [
+ TRUE,
+ FALSE,
];
- foreach ($actions as $index => $action) {
+ foreach ($statuses as $index => $value) {
// (Un)publish the node translations and check that the translation
// statuses are (un)published accordingly.
foreach ($this->langcodes as $langcode) {
$options = ['language' => $languages[$langcode]];
$url = $entity->urlInfo('edit-form', $options);
- $this->drupalPostForm($url, [], $action . $this->getFormSubmitSuffix($entity, $langcode), $options);
+ $this->drupalPostForm($url, ['status[value]' => $value], t('Save') . $this->getFormSubmitSuffix($entity, $langcode), $options);
}
$storage->resetCache([$this->entityId]);
$entity = $storage->load($this->entityId);