Not really sure whether this is a bug or a feature request. Perhaps somewhere between the two.

To see the issue:
1. Add a new Paragraphs field to a content type and edit the field.
2. Under "Allowed Paragraphs bundles," select just one bundle and Save.
3. Create a new page (Add content) of this content type.
4. Go look at your new field. It will say "No Paragraphs added yet. Select a Paragraph type and press the button below to add one."

However, since only one Paragraphs bundle is allowed here, there is no Paragraph type to select and no selection widget. In this case, the line should just say "No Paragraphs added yet. Press the button below to add one." The current behavior is confusing to the content editor.

Comments

jemandy created an issue. See original summary.

gbirch’s picture

Same problem, using 7.x-1.0-rc4 +1 for a fix, please.

azinck’s picture

Status: Active » Needs review
StatusFileSize
new0 bytes

I agree this language is confusing. Here's a patch.

azinck’s picture

Heh, let's try that again, this time with something actually in our patch :).

The last submitted patch, 3: paragraphs-ux_language_with_one_bundle-257227-3.patch, failed testing.

gadaniels72’s picture

Status: Needs review » Reviewed & tested by the community

Patch #4 worked for me. I tested by:

  • Creating 1 paragraph bundle
  • Added a paragraph field to a content type
  • Verified that there was no select button, a message of "No Paragraph added yet. Press the button below to add." with the add button below
  • Added a second paragraph bundle
  • Updated my content type to set the paragraph field to only allow the 2nd bundle
  • Verified that there was no select button, a message of "No Paragraph added yet. Press the button below to add." displayed with the add button below.
  • Updated my content type to set the paragraph field to allow an unlimited number of items
  • Verified that there was no select button, a message of "No Paragraphs added yet. Press the button below to add one." displayed with the add button below.
jeroen.b’s picture

Thanks @azinck, why are the new texts with enters in them though.
Also, the first line is missing the word "one".

Also I'm currently trying to get the quality of the code up to par with the D8 version.
That mostly just means we need to add many tests to make sure we won't break anything.
Are you able to create a unit test for this? (and provide 2 patches: 1 with the fixed code + test, 1 with the test only. that way we can see the test actually confirms it is fixed now).

jeroen.b’s picture

Status: Reviewed & tested by the community » Needs work
azinck’s picture

Issue summary: View changes
StatusFileSize
new1.48 KB
new624 bytes

The extra line breaks were caused by a bad setting I had in my IDE. I've cleaned that up. As for tests: I've only written a few unit tests and it tends to take me quite some time...I'll confess it's not high on my priority list. I'd welcome others jumping in here :).

The ommission of the word "one" in the first line is intentional. If I were to say "Press the button below to add one." it would imply that you could add more than one. The current language of "Press the button below to add." implies that there is just one to be added. That said, I'm sure the wording could be improved further. I did tweak it a bit in this patch.

jeroen.b’s picture

Yeah, making tests can consume quite some time.

I suggest "The !title has not been added yet. Press the button below to add it." for the button.
However, English is not my first language so I'm not sure that makes sense :)

azinck’s picture

English *is* my first language but I think your suggestion is better than mine :). Patch updated.

shubhangi1995’s picture

Assigned: Unassigned » shubhangi1995
shubhangi1995’s picture

created few test cases with patch #11
test cases made-
1) no paragraph bundle added in the paragraph field -
Result before adding patch-
No Paragraphs added yet. Select a Paragraph type and press the button below to add one.
No bundles available, edit field settings
Result after the patch applied
No Paragraphs added yet. Select a Paragraph type and press the button below to add one.
No bundles available, edit field settings

2) single paragraph bundle added with single paragraph per node
Result before adding patch-
No Paragraphs added yet. Select a Paragraph type and press the button below to add one.
with add button.
Result after the patch applied
The !title has not been added yet. Press the button below to add it.
with the add button.

3)single paragraph bundle added with multiple paragraphs added per node
Result before adding patch
No Paragraphs added yet. Select a Paragraph type and press the button below to add one. with add button.
Result after the patch applied
No !title_multiple added yet. Press the button below to add one. with add new paragraph button.

4) multiple paragraph bundles with single paragraph per node
Result before adding patch-
No Paragraphs added yet. Select a Paragraph type and press the button below to add one.
with add button and select list of paragraph bundles.
Result after the patch applied
No Paragraphs added yet. Select a Paragraph type and press the button below to add one.

5) multiple paragraph bundles with multiple paragraphs per node
Result before adding patch-
No Paragraphs added yet. Select a Paragraph type and press the button below to add one. with add button and select list for paragraph bundles.
Result after the patch applied
No Paragraphs added yet. Select a Paragraph type and press the button below to add one.

shubhangi1995’s picture

Status: Needs work » Reviewed & tested by the community

quimic’s picture

The patch works, but in the message "The !title has not been added yet. Press the button below to add it.", "!title" is shown as is, and is not replaced by the actual title.

hhvardan’s picture

In the following patch fixed replacement variables.

jstoller’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.47 KB

Code cleanup.

  • jstoller committed 7dc0a7a on 7.x-1.x
    Issue #2572277 by azinck, jstoller, hhvardan, shubhangi1995, quimic,...
jstoller’s picture

Status: Needs review » Fixed

Patch committed to dev.

Status: Fixed » Closed (fixed)

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

shubhangi1995’s picture

Assigned: shubhangi1995 » Unassigned