Just tested #2537732: PluginFormInterface must have access to the complete $form_state (introduce SubFormState for embedded forms) with the Search API and after a bit of tweaking and cursing everything ran fine. Which is of course great news, moving all the complexity of that class to Core would be a nice improvement for us. (Also brings larger possibility to spot any lurking bugs.)

However, since I'd guess this won't make it into the lower-version brancher (not sure, though), the question would be how we would go about doing this. Wait a bit after the Core issues gets committed and the set a minimum Drupal version? Or is there a better way? (Leaving a BC layer in for the time being might also be an option, though a rather ugly one.)

Comments

drunken monkey created an issue. See original summary.

drunken monkey’s picture

StatusFileSize
new31.66 KB

Here is the patch, in any case.

borisson_’s picture

Let's try not to leave in a bc layer if we can help it, and I agree that using those classes would be great so we don't have to support that code ourselves. I'll try to help move along the other issue if possible.

drunken monkey’s picture

Issue tags: +release target

Tagging so I don't forget this – also, I guess it's quite likely that 8.2.0 will be out when we create RC1.

borisson_’s picture

Status: Postponed » Active
drunken monkey’s picture

Status: Active » Postponed

I'd still postpone this until 8.2.0 has been released, since we can't really commit it before then anyways.

borisson_’s picture

Status: Postponed » Reviewed & tested by the community

8.2 got released!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: 2690229-2--core_subformstate.patch, failed testing.

borisson_’s picture

Issue tags: +Needs reroll

Looks like this needs a reroll.

drunken monkey’s picture

I don't know off the top of my head, but if Core's sub-form states have some introspection, maybe that would also be a clean solution to use #states in plugins (for which we already have some @todo comments).

drunken monkey’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new28.55 KB

This is the re-roll.

drunken monkey’s picture

StatusFileSize
new1.86 KB
new30.42 KB

And this also fixes the #states, at least for the Highlight processor.
The other instances were all in Views plugins, which apparently don't use sub-form states anyways.
Also, there is no introspection in Core's implementation, so that plan was off – but I discovered during the re-roll that we already set #parents before calling buildConfigurationForm() (at least in the processors form), so that was easy to implement. Still used defensive coding in case that ever changes again.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

  • drunken monkey committed 303b5f1 on 8.x-1.x
    Issue #2690229 by drunken monkey: Adapted Core's SubformState solution.
    
drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Looks good, thanks a lot for reviewing!
Committed.

Status: Fixed » Closed (fixed)

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