Issue #2744877 by katzilla, dernetzjaeger, biancajs, chipway, Gábor Hojtsy, catch, romainj, lucur, yoroy, kamalrajsahu21, dietmarg: Node add form shows 'create new revision' checkbox
parent
4f917488f1
commit
8dc87c91c3
|
@ -139,7 +139,7 @@ class NodeForm extends ContentEntityForm {
|
|||
'#type' => 'checkbox',
|
||||
'#title' => t('Create new revision'),
|
||||
'#default_value' => $node->type->entity->isNewRevision(),
|
||||
'#access' => $current_user->hasPermission('administer nodes'),
|
||||
'#access' => $current_user->hasPermission('administer nodes') && !$node->isNew(),
|
||||
'#group' => 'revision_information',
|
||||
);
|
||||
|
||||
|
|
|
@ -72,6 +72,12 @@ class NodeCreationTest extends NodeTestBase {
|
|||
$this->drupalGet('node/' . $node->id());
|
||||
$this->assertText($node->getOwner()->getUsername());
|
||||
$this->assertText(format_date($node->getCreatedTime()));
|
||||
|
||||
// Check if the node revision checkbox is not rendered on node creation form.
|
||||
$admin_user = $this->drupalCreateUser(array('administer nodes', 'create page content'));
|
||||
$this->drupalLogin($admin_user);
|
||||
$this->drupalGet('node/add/page');
|
||||
$this->assertNoFieldById('edit-revision', NULL , 'The revision checkbox is not present.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -111,6 +111,10 @@ class NodeEditFormTest extends NodeTestBase {
|
|||
$first_node_version = node_revision_load($node->getRevisionId());
|
||||
$second_node_version = node_revision_load($revised_node->getRevisionId());
|
||||
$this->assertNotIdentical($first_node_version->getRevisionUser()->id(), $second_node_version->getRevisionUser()->id(), 'Each revision has a distinct user.');
|
||||
|
||||
// Check if the node revision checkbox is rendered on node edit form.
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->assertFieldById('edit-revision', NULL, 'The revision field is present.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue