Commit 210ca8a1 authored by webchick's avatar webchick

Issue #2912333 by vijaycs85, gilesmc, phenaproxima: Revision log field doesn't...

Issue #2912333 by vijaycs85, gilesmc, phenaproxima: Revision log field doesn't appear under 'Revision Information' tab
parent 5cfa420d
......@@ -390,6 +390,7 @@ public function updateChangedTime(EntityInterface $entity) {
* An associative array containing the structure of the form.
*/
protected function addRevisionableFormFields(array &$form) {
/** @var ContentEntityTypeInterface $entity_type */
$entity_type = $this->entity->getEntityType();
$new_revision_default = $this->getNewRevisionDefault();
......@@ -420,9 +421,10 @@ protected function addRevisionableFormFields(array &$form) {
'#access' => !$this->entity->isNew() && $this->entity->get($entity_type->getKey('revision'))->access('update'),
'#group' => 'revision_information',
];
if (isset($form['revision_log'])) {
$form['revision_log'] += [
// Get log message field's key from definition.
$log_message_field = $entity_type->getRevisionMetadataKey('revision_log_message');
if ($log_message_field && isset($form[$log_message_field])) {
$form[$log_message_field] += [
'#group' => 'revision_information',
'#states' => [
'visible' => [
......
......@@ -55,6 +55,13 @@ public function testMediaFileSource() {
// Make sure the thumbnail is displayed.
$assert_session->elementAttributeContains('css', '.image-style-thumbnail', 'src', 'generic.png');
// Make sure checkbox changes the visibility of log message field.
$this->drupalGet("media/1/edit");
$page->uncheckField('revision');
$assert_session->elementAttributeContains('css', '.field--name-revision-log-message', 'style', 'display: none');
$page->checkField('revision');
$assert_session->elementAttributeNotContains('css', '.field--name-revision-log-message', 'style', 'display');
// Load the media and check if the label was properly populated.
$media = Media::load(1);
$this->assertEquals($test_filename, $media->getName());
......
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