Problem/Motivation

comment_form_field_ui_field_storage_edit_form_alter() is supposed to limit comment fields to cardinality 1, but it's no longer working

Proposed resolution

fix it

Remaining tasks

everything

User interface changes

none

API changes

none

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug because UX regression
Issue priority Normal because not really broken without it, but prevents mega-weirdness
Prioritized changes The main goal of this issue is usability.  This is a prioritized change for the beta phase.
Disruption None
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan’s picture

Issue tags: +Novice
larowlan’s picture

Issue tags: +Needs tests
SteffenR’s picture

Status: Active » Needs review
FileSize
821 bytes

By working on this issue, i found another "issue" with the latest 8.0.x.
I'm not sure, if i misconfigured my page after installation - but i don't get any Comment types - even if i create new types on Structure > Comment Types.

Comment Types not available

Attached you find a patch setting cardinality_container back to be not visible as they were before.

SteffenR

SteffenR’s picture

FileSize
35.25 KB
SteffenR’s picture

larowlan’s picture

Should be red/green

The last submitted patch, 6: comment-alter-2399307.fail_.patch, failed testing.

Berdir’s picture

+++ b/core/modules/comment/comment.module
@@ -351,8 +351,8 @@ function comment_form_field_ui_field_storage_edit_form_alter(&$form, FormStateIn
-    $form['field']['cardinality_container']['cardinality']['#options'] = array(1 => 1);
-    $form['field']['cardinality_container']['#access'] = FALSE;
+    $form['field_storage']['cardinality_container']['cardinality']['#options'] = array(1 => 1);
+    $form['field_storage']['cardinality_container']['#access'] = FALSE;

not sure why we change #options instead of changing #default_value?

Would it make sense to also verify that the created field has cardinality 1, or are we already doing this?

larowlan’s picture

Sure

Berdir’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, RTBC if green :)

larowlan’s picture

Issue summary: View changes

Added beta evaluation

rpayanm’s picture

Status: Reviewed & tested by the community » Needs work
FileSize
21.24 KB

Hello, I don't get any Comment types when I apply the last patch, this behavior is well?

Comment

Berdir’s picture

Status: Needs work » Reviewed & tested by the community

That's a separate issue. You're trying to add a comment field to users, you need to create a comment type for that first.

rpayanm’s picture

FileSize
21.39 KB

@Berdir You are right!

Comment

pwolanin’s picture

Is there really no way a field item can declare it only supports cardinality one? I was looking earlier, and it's certainly not evident how it would work.

larowlan’s picture

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 7a52a88 and pushed to 8.0.x. Thanks!

Thanks for adding the beta evaluation to the summary.

  • alexpott committed 7a52a88 on 8.0.x
    Issue #2399307 by larowlan, SteffenR:...

Status: Fixed » Closed (fixed)

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