Using Services module and drupal_form_submit to create a node, I get Illegal choice 0 in Comments element in form.inc:1266
Dumping the element at this point yields:
[#options] => Array
(
[2] => Open
[1] => Closed
)

I've tracked this down to the "hidden" option being removed in the comment module line 1229.

Comments

sun’s picture

Title: Missing hidden option in comment settings form » Removal of "Hidden" option in comment settings form may break programmatic form submissions
Version: 7.2 » 8.x-dev
Priority: Major » Normal
Issue tags: +Needs backport to D7
dixon_’s picture

This one is related, but not really the same: #989452: Make comment settings form more usable

Everett Zufelt’s picture

Status: Active » Needs review
StatusFileSize
new1.03 KB

Rewords description of 'Hidden' comment setting, and removes code that removes the 'Hidden' option for nodes without existing comments.

Status: Needs review » Needs work
Issue tags: -Needs backport to D7

The last submitted patch, 1181750.patch, failed testing.

Everett Zufelt’s picture

Status: Needs work » Needs review
Issue tags: +Needs backport to D7

#3: 1181750.patch queued for re-testing.

Everett Zufelt’s picture

Cannot reproduce install failure on head or head + patch.

sun’s picture

StatusFileSize
new871 bytes

Attached patch is what you want. As this needs to be backported, no UI string changes here.

Everett Zufelt’s picture

Status: Needs review » Reviewed & tested by the community

Sun's patch looks good. I wasn't aware of the #access property, but this will allow the UI to remain the same, while allowing for programmatic submission of a form with the comment setting set to 'Hidden'.

catch’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Yep, should always use #access rather than unsetting elements. Committed/pushed to 8.x, moving to 7.x for backport.

Everett Zufelt’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new851 bytes

Ported to d7

Everett Zufelt’s picture

Issue tags: -Needs backport to D7
catch’s picture

Issue tags: +Needs backport to D7

Please leave the tag. It's the only way to distinguish between patches that have already been committed to 8.x, vs. new patches in the queue against 7.x (which are mis-placed 99% of the time).

sun’s picture

Status: Needs review » Reviewed & tested by the community
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Hm. it seems lke we could add a test for this, but since #access is unlikely to get un-done, I guess it can go in without.

Committed and pushed to 7.x. Thanks!

xjm’s picture

Version: 7.x-dev » 8.x-dev
Status: Fixed » Active
Issue tags: +Needs tests

I think a test would be a good idea in this case. Moving to 8.x for a followup with a test.

tte’s picture

Assigned: Unassigned » tte
yesct’s picture

Assigned: tte » Unassigned
Issue summary: View changes
andypost’s picture

Tests could be added to \Drupal\comment\Tests\CommentInterfaceTest the fixed code now lives in \Drupal\comment\Plugin\Field\FieldWidget\CommentWidget

andypost’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.