Problem/Motivation

+++ b/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php
@@ -748,33 +783,11 @@ class InlineParagraphsWidget extends WidgetBase {
+ $field_state = static::getWidgetState($this->parents, $field_name, $form_state);

The two set/get calls to this were there before, we're just renaming variables. I think changing that would be better to be done.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

toncic created an issue. See original summary.

Berdir’s picture

You can do better than that with the issue title

Ginovski’s picture

Status: Active » Needs review

Tried to find this, but isn't the renaming done in the #2830550: Create helper methods for "Add paragraphs" modes issue?

miro_dietiker’s picture

Title: The two set/get calls » Two setWidgetState calls in formElementMultiple
Status: Needs review » Fixed

This is not about renaming. It's about reducing the code to only set the widget state once.

Line 771

    static::setWidgetState($this->fieldParents, $field_name, $form_state, $field_state);

Line 820

    static::setWidgetState($this->fieldParents, $field_name, $form_state, $field_state);

The problem is that in between we call formSingleElement that then does a formElement
And the formElement gets the widget state again at line 223:

    $widget_state = static::getWidgetState($parents, $field_name, $form_state);

Added a comment, so this is needed and OK.

  • miro_dietiker committed f11cf4c on 8.x-1.x
    Issue #2834824 by miro_dietiker: Two setWidgetState calls in...

Status: Fixed » Closed (fixed)

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