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 1 forks source link

adds parent field for elections #128

Open markconroy opened 3 months ago

markconroy commented 3 months ago

Closes #107

What does this change?

Adds a "parent" field so we can use this for breadcrumbs and URL aliases.

Currently doesn't set any content types as allowed parents. If we did, it would mean a lot of dependencies for this module, where it currently has none. This means after you enable the module, you will then need to set what content types are allowed to be parents

How to test

Enable the module, create an election (or enable election demo content module), set a node as the parent and check that the URL inherits from the parent URL.

Have we considered potential risks?

This only applies to new installs currently, do we want an update hook to apply to current sites?

finnlewis commented 2 months ago

Might want a bit more discussion https://github.com/localgovdrupal/localgov_elections/issues/107#issuecomment-2298645589

finnlewis commented 3 weeks ago

Quick discussion in Merge Tuesday, from the original issue, we want to amend this to use the services reference field.

Do we want an update hook to add the services field ?

@Mjeffbrown @nccchris did you add the services field to your elections content ?

If no, then let's add an update hook.

(Or check to see if it is there and update if not)

Note: add in hook_modules_installed , check step-by-step for pro-forma.

stephen-cox commented 1 week ago

Discussing at Merge Tuesday - we want to add the services parent here. There's example code in other modules that does this that can be copied.

markconroy commented 4 days ago

This PR is updated now to follow the same pattern that LocalGov Directories uses.

However, although the field is placed on 'Manage form' page for the election content type, it says the field formatter is 'Autocomplete Deluxe' and I'm not sure how to change that since our code says to use 'entity_reference_autocomplete'.

@stephen-cox would you have a quick check of this and see if there's an easy fix?