Unverified Commit 19d0533f authored by alexpott's avatar alexpott

Issue #2927408 by Anas_maw, Erik Frèrejean, timmillwood, Sam152, catch:...

Issue #2927408 by Anas_maw, Erik Frèrejean, timmillwood, Sam152, catch: Default value not correctly set in the ModerationStateWidget
parent 39183a29
......@@ -131,6 +131,9 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
foreach ($transitions as $transition) {
$transition_to_state = $transition->to();
$transition_labels[$transition_to_state->id()] = $transition_to_state->label();
if ($default->id() === $transition_to_state->id()) {
$default_value = $default->id();
}
}
$element += [
......
......@@ -107,6 +107,10 @@ public function testModerationForm() {
'moderation_state[0][state]' => 'published',
], t('Save'));
// Check widget default value.
$this->drupalGet($edit_path);
$this->assertFieldByName('moderation_state[0][state]', 'published', 'The moderation default value is set correctly.');
// The published view should not have a moderation form, because it is the
// live revision.
$this->drupalGet($canonical_path);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment