Problem/Motivation
Comment settings Closed option unavailable despite current value is Closed.
Noticed this after migrating nodes from d7.
Migrated node has comment settings = Closed, but on node edit form the Closed option is unavailable/does not show.
Proposed resolution
There's a type mistmatch between $element['status']['#default_value'] and CommentItemInterface::CLOSED at core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php:56.
Maybe just cast the prior to int or not use strict comparison !=?
// Only hide the option when it's not the currently selected option.
if ((int) $element['status']['#default_value'] !== CommentItemInterface::CLOSED) {
$element['status'][CommentItemInterface::CLOSED]['#access'] = FALSE;
}
Comments
Comment #2
drpldrp commentedComment #3
drpldrp commentedComment #4
drpldrp commentedComment #5
lauriiiThank you for opening the issue @drpldrp! If you have a chance, it would be great if you could file a merge request since our CI doesn't work with patches anymore. 😊