- 🇮🇹Italy apaderno Brescia, 🇮🇹
As a comment in the code says, he idea behind using a counter is to make entering a value for the string_to_add form element optional.
Given that $queue->createItem() will always create a new item, even when it gets a value already used in a previous call, I think there is no need to use a counter to build a new queue item. The string_to_add form element should require a value, and that value should always be used to create a new queue item.$form['insert_fieldset']['string_to_add'] = [ '#type' => 'textfield', '#required' => TRUE, '#size' => 10, '#default_value' => $this->t('Change me')]), ];
It is not a bug entering two or more times the same value in the queue, since the purpose of that example form is adding to the queue whichever value entered for the string_to_add form element. The bug is that the code tries to use a different value for the default value of that form element, but that code ends up with using the same value as default value, for the reason said by @Miles23 in comment #2 🐛 'string_to_add' form element never increments Needs work .
I agree with what said in that comment: There is no need to have a text field with an auto-incrementing value.
Let's keep it simple: The string_to_add form element requires a value; whichever value is entered, that is added to the queue.
Eventually, I would not accept a value that contains spaces or other non-visible characters. - Merge request !79Issue #2978404: 'string_to_add' form element never increments → (Merged) created by apaderno
- Status changed to Needs review
4 months ago 6:29pm 14 July 2024 -
apaderno →
committed 3ddcca23 on 4.0.x
Issue #2978404: 'string_to_add' form element never increments
-
apaderno →
committed 3ddcca23 on 4.0.x
- Status changed to Fixed
4 months ago 6:49pm 14 July 2024 Automatically closed - issue fixed for 2 weeks with no activity.