- Issue created by @daletrexel
- Merge request !3Proposed solution for issue #3535936, though need to confirm whether null... β (Open) created by daletrexel
If you have revisions enabled for media, but do NOT have revision log messages enabled in the edit form, editing a media entity will result in two warnings:
In revision_log_message.module. line 26 is:
$form['revision']['#access'] = $form['revision_log_message']['#access'];
but the 'revision_log_message' key is not present if there is no revision log message field in the Default form view. Enabling the field populates the field and removes the message, but this should not be necessary. The module should work fine without requiring the revision log field.
This can easily be resolved with a null coalescing operator, but I'm not sure what the logic in this line of code is here for. Should it default to true of false?
$form['revision']['#access'] = ($form['revision_log_message']['#access']) ?? TRUE;
$form['revision']['#access'] = ($form['revision_log_message']['#access']) ?? FALSE;
I've played with settings for revisions and revision logs, and I can't get the log field to show up whatever settings I apply. And whether the null coalescing operator is true or false doesn't seem to matter for our site.
It is interesting that the following bit of code does test for whether the key is set. We need a similar bit of validation for the previous line.
Enable this module and media revisions on a Drupal site, but without including the revision log field in the media editing form.
Add the appropriate null coalescing operator, as indicated above.
None.
None.
None.
None.
Active
2.0
Code