localgovdrupal / localgov_elections

This module provides submodules, content types, views and configuration that allow the reporting of election results for the LocalGov Drupal distribution.
GNU General Public License v2.0
1 stars 0 forks source link

Fix issue with demo content taxonomy names #97

Closed chriswales95 closed 2 months ago

chriswales95 commented 2 months ago

Should close #91.

What this PR does:

  1. Removes brackets from demo content party names
  2. Adds warning to taxonomy page for party name in party taxonomy page
  3. Adds warning to candidate party autocomplete field widget
  4. Adds a patch so the help text appears on autocomplete deluxe widget
finnlewis commented 2 months ago

This reverts a commit I made to rename the demo content taxonomy names: https://github.com/localgovdrupal/localgov_elections/commit/dae0f9fbd76c16167102ea04b41ab8aed5ba2caf

This was done because people testing were confused about the duplicate parties when enabling the demo content and the UK parties module.

I can't find the original issue, maybe it was in Slack?

Either way, I think we need a way for user to distinguish between demo taxonomy terms and those generated by the UK parties module.

But more fundamentally, I wonder why are brackets a problem in taxonomy term names in this instance.

chriswales95 commented 2 months ago

@finnlewis Ah I wasn't aware.

Basically, entity references fields usally have stuff in the form entity title (entity id). It must do some pattern matching with the brackets. When I looked in xdebug in the form state, it had arrays in the form of (just making this up but it's close enough) [ field_value => [ "target_id" => "demo content"] ] for taxonomy names like "Labour (demo content)".

Mabye square brackets would work?

markconroy commented 2 months ago

Handiest might be to change the names to Labour - demo content instead of Labour (demo content)

chriswales95 commented 2 months ago

@markconroy That's sensible. I'll make the change soon.

chriswales95 commented 2 months ago

I did try and do some validation in the form validation hook but could not get the full text from the input :/. It would be good to revisit that at some point as well.

chriswales95 commented 2 months ago

@markconroy @finnlewis @dedavidson Switched to using the dashes. @finnlewis this should fix your problem.

finnlewis commented 2 months ago

Testing, thanks @chriswales95 !