From 23bac789b2aa1afaea31b128fdb9f87fba9d5606 Mon Sep 17 00:00:00 2001 From: Mark Conroy Date: Mon, 5 Aug 2024 16:36:00 +0100 Subject: [PATCH 01/10] adds better spacing for election overview --- css/election-results.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/css/election-results.css b/css/election-results.css index 4e646bf..63484c6 100644 --- a/css/election-results.css +++ b/css/election-results.css @@ -1,3 +1,10 @@ +.localgov-election__content > * + * { + margin-top: 3rem; + padding-top: 3rem; + border-top: var(--table-border); +} + + .county-summary__subheading { padding: 1rem; background-color: var(--color-grey); From 118cf6e18d728c129d79f462054a2823dfcf1869 Mon Sep 17 00:00:00 2001 From: Mark Conroy Date: Mon, 5 Aug 2024 16:48:36 +0100 Subject: [PATCH 02/10] removes call to non-existant CSS file --- localgov_elections.libraries.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/localgov_elections.libraries.yml b/localgov_elections.libraries.yml index b0d0689..72e098c 100644 --- a/localgov_elections.libraries.yml +++ b/localgov_elections.libraries.yml @@ -10,7 +10,6 @@ election: version: 1.x css: theme: - css/variables.css: { } css/election-results.css: { } electoral_candidates_view: From 1468d5f2726a84b2232f3f58ba984aceecaa303b Mon Sep 17 00:00:00 2001 From: Mark Conroy Date: Mon, 5 Aug 2024 16:55:45 +0100 Subject: [PATCH 03/10] sets chart restults to use whole numbers --- js/chartjs-override.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/chartjs-override.js b/js/chartjs-override.js index e2b7d2b..5a2c581 100644 --- a/js/chartjs-override.js +++ b/js/chartjs-override.js @@ -33,6 +33,7 @@ colour = null; }); chart_data.data.datasets[0].backgroundColor = data; + chart_data.options.scales.x.ticks.precision = 0; }; Drupal.behaviors.charts_override = { From 55d5d7b0b0c063df03c842c366713861f477453d Mon Sep 17 00:00:00 2001 From: Mark Conroy Date: Tue, 6 Aug 2024 10:24:18 +0100 Subject: [PATCH 04/10] adds comma for thousands separator in results --- config/install/views.view.localgov_election_results.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/install/views.view.localgov_election_results.yml b/config/install/views.view.localgov_election_results.yml index bab5f9e..36fc194 100644 --- a/config/install/views.view.localgov_election_results.yml +++ b/config/install/views.view.localgov_election_results.yml @@ -1188,7 +1188,7 @@ display: click_sort_column: value type: number_integer settings: - thousand_separator: '' + thousand_separator: ',' prefix_suffix: true group_column: value group_columns: { } From 21dea56be3bda84059d49dff1f6e3582d6d25f2f Mon Sep 17 00:00:00 2001 From: Mark Conroy Date: Tue, 6 Aug 2024 11:14:44 +0100 Subject: [PATCH 05/10] fix to show all parties on mobile --- js/chartjs-override.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/chartjs-override.js b/js/chartjs-override.js index e2b7d2b..a1b87f7 100644 --- a/js/chartjs-override.js +++ b/js/chartjs-override.js @@ -42,7 +42,7 @@ let data = e.detail; const id = data.drupalChartDivId; Drupal.localgov_elections.setChartColours(data, settings); - if (id === 'chart-election-results-via-parties-block-1') { + if (id === 'chart-election-results-via-parties-block-1' || 'chart-localgov-election-results-via-parties-block-1') { data.options.scales.y.grid = { display: false}; data.options.scales.y.ticks.autoSkip = false; } From acbca95d44cd1ba77606f4ee73c8c1d9f64132f6 Mon Sep 17 00:00:00 2001 From: Mark Conroy Date: Tue, 6 Aug 2024 11:28:03 +0100 Subject: [PATCH 06/10] adds label to hold/gain field for table --- config/install/views.view.localgov_election_results.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/install/views.view.localgov_election_results.yml b/config/install/views.view.localgov_election_results.yml index bab5f9e..9566418 100644 --- a/config/install/views.view.localgov_election_results.yml +++ b/config/install/views.view.localgov_election_results.yml @@ -958,7 +958,7 @@ display: group_type: group admin_label: '' plugin_id: field - label: '' + label: Hold/Gain exclude: false alter: alter_text: true From 9bfca67052598904634de4d40119d5c5b1eba32d Mon Sep 17 00:00:00 2001 From: Lee <8024370+millnut@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:50:37 +0100 Subject: [PATCH 07/10] fix: static analysis check errors (#129) * fix: static analysis check errors * fix: coding standards * fix: test errors * fix: test error --- localgov_elections.module | 2 +- .../UkConstituencyTwentyFourProviderDownloadForm.php | 2 +- .../tests/src/Functional/FormTest.php | 2 +- .../Plugin/BoundaryProvider/OnsTwentyThreeWards.php | 2 +- .../src/Form/AreaVoteSocialPostForm.php | 2 +- src/Annotation/BoundaryProvider.php | 10 ++++++++++ src/Plugin/Block/AnalysisBlock.php | 3 ++- src/Plugin/views/field/ElectionSeatsParty.php | 2 +- tests/src/Functional/ElectionAliasTest.php | 4 ++-- 9 files changed, 20 insertions(+), 9 deletions(-) diff --git a/localgov_elections.module b/localgov_elections.module index 0338508..d0f85b0 100644 --- a/localgov_elections.module +++ b/localgov_elections.module @@ -523,7 +523,7 @@ function localgov_elections_menu_local_tasks_alter(&$data, $route_name) { // Add the "add area" button to the local tasks if user has permission. $can_add_areas = Drupal::currentUser()->hasPermission('can fetch boundaries'); - if ($can_add_areas && in_array($route_name, $appropriate_fetch_routes)) { + if ($can_add_areas && in_array($route_name, $appropriate_fetch_routes, TRUE)) { $data['tabs'][0]['boundary_fetch'] = [ '#theme' => 'menu_local_task', '#weight' => 100, diff --git a/modules/localgov_elections_constituency_provider/src/Form/UkConstituencyTwentyFourProviderDownloadForm.php b/modules/localgov_elections_constituency_provider/src/Form/UkConstituencyTwentyFourProviderDownloadForm.php index fc42fde..052bd0b 100644 --- a/modules/localgov_elections_constituency_provider/src/Form/UkConstituencyTwentyFourProviderDownloadForm.php +++ b/modules/localgov_elections_constituency_provider/src/Form/UkConstituencyTwentyFourProviderDownloadForm.php @@ -121,7 +121,7 @@ public function validateConfigurationForm(array &$form, FormStateInterface $form // seen before. It needs to be in the dataset. $constituencies = $this->cacheBackend->get(CacheKey::CONSTITUENCY_NAMES_KEY)?->data; foreach ($values as $val) { - if (!in_array($val, $constituencies)) { + if (!in_array($val, $constituencies, TRUE)) { $form_state->setErrorByName('constituencies', "$val does not seem to be a valid choice."); } } diff --git a/modules/localgov_elections_constituency_provider/tests/src/Functional/FormTest.php b/modules/localgov_elections_constituency_provider/tests/src/Functional/FormTest.php index 9cf059e..08bd1bf 100644 --- a/modules/localgov_elections_constituency_provider/tests/src/Functional/FormTest.php +++ b/modules/localgov_elections_constituency_provider/tests/src/Functional/FormTest.php @@ -113,7 +113,7 @@ public function testConstituencyLookupEndpoint(): void { $this->assertIsArray($response); - $this->assertTrue(in_array(['label' => 'Edinburgh South West', 'value' => 'Edinburgh South West'], $response)); + $this->assertTrue(in_array(['value' => 'Edinburgh South West', 'label' => 'Edinburgh South West'], $response, TRUE)); } } diff --git a/modules/localgov_elections_ons_twenty_three_wards/src/Plugin/BoundaryProvider/OnsTwentyThreeWards.php b/modules/localgov_elections_ons_twenty_three_wards/src/Plugin/BoundaryProvider/OnsTwentyThreeWards.php index 70c1b91..8a58d26 100644 --- a/modules/localgov_elections_ons_twenty_three_wards/src/Plugin/BoundaryProvider/OnsTwentyThreeWards.php +++ b/modules/localgov_elections_ons_twenty_three_wards/src/Plugin/BoundaryProvider/OnsTwentyThreeWards.php @@ -167,7 +167,7 @@ protected function fetchBoundaryInformation($lad, $ids): array { $matched_features = []; if ($response->getStatusCode() == 200) { foreach ($json_decoded['features'] as $feature) { - if (in_array($feature['properties']['WD23CD'], $ids)) { + if (in_array($feature['properties']['WD23CD'], $ids, TRUE)) { $matched_features[] = $feature; $num_matched++; } diff --git a/modules/localgov_elections_social_post/src/Form/AreaVoteSocialPostForm.php b/modules/localgov_elections_social_post/src/Form/AreaVoteSocialPostForm.php index d9e82f7..56b57d8 100644 --- a/modules/localgov_elections_social_post/src/Form/AreaVoteSocialPostForm.php +++ b/modules/localgov_elections_social_post/src/Form/AreaVoteSocialPostForm.php @@ -330,7 +330,7 @@ protected function getTokenizedMessage($form, FormStateInterface $form_state) { public function submitForm(array &$form, FormStateInterface $form_state): void { $keys = array_keys($form_state->get('original_data')['account']); $accounts = array_filter($this->userManager->getAccounts('social_post_twitter'), function ($obj) use ($keys) { - return in_array($obj->id(), $keys); + return in_array($obj->id(), $keys, TRUE); }); $message = $form_state->getValue('preview'); diff --git a/src/Annotation/BoundaryProvider.php b/src/Annotation/BoundaryProvider.php index b18acbc..7d595ac 100644 --- a/src/Annotation/BoundaryProvider.php +++ b/src/Annotation/BoundaryProvider.php @@ -9,12 +9,16 @@ /** * Defines boundary_provider annotation object. * + * @see plugin_api + * * @Annotation */ class BoundaryProvider extends Plugin { /** * The plugin ID. + * + * @phpstan-ignore-next-line This is allowed in Drupal, but PHPStan complains even though this is valid */ public readonly string $id; @@ -22,6 +26,8 @@ class BoundaryProvider extends Plugin { * The human-readable name of the plugin. * * @ingroup plugin_translatable + * + * @phpstan-ignore-next-line This is allowed in Drupal, but PHPStan complains even though this is valid */ public readonly string $title; @@ -29,6 +35,8 @@ class BoundaryProvider extends Plugin { * The description of the plugin. * * @ingroup plugin_translatable + * + * @phpstan-ignore-next-line This is allowed in Drupal, but PHPStan complains even though this is valid */ public readonly string $description; @@ -39,6 +47,8 @@ class BoundaryProvider extends Plugin { * form at the moment. * * @returns array + * + * @phpstan-ignore-next-line This is allowed in Drupal, but PHPStan complains even though this is valid */ public array $form = []; diff --git a/src/Plugin/Block/AnalysisBlock.php b/src/Plugin/Block/AnalysisBlock.php index 4fef7e2..1f05bff 100644 --- a/src/Plugin/Block/AnalysisBlock.php +++ b/src/Plugin/Block/AnalysisBlock.php @@ -109,7 +109,7 @@ public function build() { } // Display majority if we can. - if ($display_majority && isset($majority)) { + if ($display_majority && !is_null($majority)) { $markup .= '
Majority
'; $markup .= '
' . $majority . '
'; } @@ -118,6 +118,7 @@ public function build() { $previous_year = $node->localgov_election_previous_year->value; $previous_winning_party = $node->localgov_election_prev_winner->entity; $previous_result = $node->localgov_election_prev_result->referencedEntity; + $previous_winner_abbr = ''; if (isset($previous_winning_party)) { $previous_winner_abbr = $previous_winning_party->localgov_election_abbreviation->value; } diff --git a/src/Plugin/views/field/ElectionSeatsParty.php b/src/Plugin/views/field/ElectionSeatsParty.php index f740553..bed17e2 100644 --- a/src/Plugin/views/field/ElectionSeatsParty.php +++ b/src/Plugin/views/field/ElectionSeatsParty.php @@ -69,7 +69,7 @@ public function render(ResultRow $values) { // Find party of Ward/Area/Division winning candidate. $winning_cand_id = $ward->get('localgov_election_winner')->target_id; - if (isset($winning_cand_id)) { + if (!is_null($winning_cand_id)) { $winning_cand = Paragraph::load($winning_cand_id); if (isset($winning_cand)) { $winning_party = $winning_cand->get('localgov_election_party')->target_id; diff --git a/tests/src/Functional/ElectionAliasTest.php b/tests/src/Functional/ElectionAliasTest.php index 15b7053..a6fd65a 100644 --- a/tests/src/Functional/ElectionAliasTest.php +++ b/tests/src/Functional/ElectionAliasTest.php @@ -92,7 +92,7 @@ protected function setUp(): void { ]); $file->save(); - $this->area_vote = $this->nodeStorage->create([ + $this->areaVote = $this->nodeStorage->create([ 'title' => "An area", 'status' => TRUE, 'type' => "localgov_area_vote", @@ -104,7 +104,7 @@ protected function setUp(): void { 'coordinates' => [1.234567, 2.345678], ]), ]); - $this->area_vote->save(); + $this->areaVote->save(); // Map page. $map_page_url = Url::fromRoute('view.localgov_election_electoral_map.page_1', From 5a596ce799c9ba1203fbe672e8bcacffbf67131e Mon Sep 17 00:00:00 2001 From: Lee Mills <8024370+millnut@users.noreply.github.com> Date: Fri, 18 Oct 2024 19:34:59 +0100 Subject: [PATCH 08/10] fix: coding standards --- .../src/Form/AreaVoteSocialPostForm.php | 2 +- src/Form/BoundaryFetchForm.php | 2 +- tests/src/Functional/ElectionAliasTest.php | 2 +- tests/src/Functional/ElectionSummaryTest.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/localgov_elections_social_post/src/Form/AreaVoteSocialPostForm.php b/modules/localgov_elections_social_post/src/Form/AreaVoteSocialPostForm.php index 56b57d8..c926c49 100644 --- a/modules/localgov_elections_social_post/src/Form/AreaVoteSocialPostForm.php +++ b/modules/localgov_elections_social_post/src/Form/AreaVoteSocialPostForm.php @@ -149,7 +149,7 @@ public function getFormId(): string { /** * {@inheritdoc} */ - public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node = NULL): array { + public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $node = NULL): array { if ($node->bundle() != "localgov_area_vote") { $this->messenger()->addError("Can only post from area vote nodes"); return $form; diff --git a/src/Form/BoundaryFetchForm.php b/src/Form/BoundaryFetchForm.php index f6d86bf..27a5083 100644 --- a/src/Form/BoundaryFetchForm.php +++ b/src/Form/BoundaryFetchForm.php @@ -98,7 +98,7 @@ public function getFormId(): string { /** * {@inheritdoc} */ - public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node = NULL): array { + public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $node = NULL): array { // It doesn't make sense to allow non-elections // using this form so deny any of the form. // @todo would it make sense to redirect somewhere? Or throw an error? diff --git a/tests/src/Functional/ElectionAliasTest.php b/tests/src/Functional/ElectionAliasTest.php index a6fd65a..d1814a7 100644 --- a/tests/src/Functional/ElectionAliasTest.php +++ b/tests/src/Functional/ElectionAliasTest.php @@ -5,9 +5,9 @@ namespace Drupal\Tests\localgov_elections\Functional; use Drupal\Core\Url; +use Drupal\Tests\BrowserTestBase; use Drupal\file\Entity\File; use Drupal\node\NodeStorageInterface; -use Drupal\Tests\BrowserTestBase; /** * Tests alias functionality for Election nodes. diff --git a/tests/src/Functional/ElectionSummaryTest.php b/tests/src/Functional/ElectionSummaryTest.php index eb190c1..f66a099 100644 --- a/tests/src/Functional/ElectionSummaryTest.php +++ b/tests/src/Functional/ElectionSummaryTest.php @@ -4,8 +4,8 @@ namespace Drupal\Tests\localgov_elections\Functional; -use Drupal\node\NodeInterface; use Drupal\Tests\BrowserTestBase; +use Drupal\node\NodeInterface; /** * Tests results heading text on the summary page. From b6355abe467915bcd1103a40dc2ced019ecce09d Mon Sep 17 00:00:00 2001 From: Lee Mills <8024370+millnut@users.noreply.github.com> Date: Fri, 18 Oct 2024 19:45:04 +0100 Subject: [PATCH 09/10] fix: allow paragraphs_table to be upgraded --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 58deb5d..45eafec 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "drupal/entity_extra_field": "^2.1@RC", "drupal/color_field": "^3.0", "drupal/field_formatter_class":" ^1.5", - "drupal/paragraphs_table": "^1.6", + "drupal/paragraphs_table": "^1.23 || ^2.0", "cweagans/composer-patches": "^1.6", "drupal/charts": "^5.0", "drupal/views_field_view": "^1.0@beta", From 6e3028f80c7f6f6ea85fdd55afaa236d2ec1e4ca Mon Sep 17 00:00:00 2001 From: Lee <8024370+millnut@users.noreply.github.com> Date: Tue, 22 Oct 2024 12:37:40 +0100 Subject: [PATCH 10/10] =?UTF-8?q?fix:=20test=20failure=20due=20to=20missin?= =?UTF-8?q?g=20content=20moderation=20status=20on=20demo=20co=E2=80=A6=20(?= =?UTF-8?q?#135)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: test failure due to missing content moderation status on demo content * fix: test failure due to path aliases needing regeneration --- .../03c28275-05bd-4082-a629-101064faa287.yml | 3 +++ .../23ffd187-52df-4106-9c19-af542d51a738.yml | 3 +++ .../323fb108-c7e6-4ab8-89e1-8a2705ce6cfa.yml | 3 +++ .../40b48ccc-4694-4718-96ae-a47cbdba8728.yml | 3 +++ .../4d5aff55-8f5e-4195-acf0-a49cf259f84c.yml | 3 +++ .../5f652852-df67-4d5e-9e23-fc96c90a0f43.yml | 3 +++ .../7d910eb2-029f-4688-a060-0319dc888ca1.yml | 3 +++ .../dd93c0fa-53b1-49fa-8dc7-066b83ea3bcb.yml | 3 +++ .../localgov_elections_demo_content.module | 25 +++++++++++++++++++ 9 files changed, 49 insertions(+) create mode 100644 modules/localgov_elections_demo_content/localgov_elections_demo_content.module diff --git a/modules/localgov_elections_demo_content/content/node/03c28275-05bd-4082-a629-101064faa287.yml b/modules/localgov_elections_demo_content/content/node/03c28275-05bd-4082-a629-101064faa287.yml index 0e5ea3c..24bfc4b 100644 --- a/modules/localgov_elections_demo_content/content/node/03c28275-05bd-4082-a629-101064faa287.yml +++ b/modules/localgov_elections_demo_content/content/node/03c28275-05bd-4082-a629-101064faa287.yml @@ -36,6 +36,9 @@ default: revision_translation_affected: - value: true + moderation_state: + - + value: published path: - alias: /election/general-election-july-2024/henley-and-thame diff --git a/modules/localgov_elections_demo_content/content/node/23ffd187-52df-4106-9c19-af542d51a738.yml b/modules/localgov_elections_demo_content/content/node/23ffd187-52df-4106-9c19-af542d51a738.yml index 0729814..999a8ee 100644 --- a/modules/localgov_elections_demo_content/content/node/23ffd187-52df-4106-9c19-af542d51a738.yml +++ b/modules/localgov_elections_demo_content/content/node/23ffd187-52df-4106-9c19-af542d51a738.yml @@ -29,6 +29,9 @@ default: revision_translation_affected: - value: true + moderation_state: + - + value: published path: - alias: /election/general-election-july-2024 diff --git a/modules/localgov_elections_demo_content/content/node/323fb108-c7e6-4ab8-89e1-8a2705ce6cfa.yml b/modules/localgov_elections_demo_content/content/node/323fb108-c7e6-4ab8-89e1-8a2705ce6cfa.yml index dff06dd..5c5e979 100644 --- a/modules/localgov_elections_demo_content/content/node/323fb108-c7e6-4ab8-89e1-8a2705ce6cfa.yml +++ b/modules/localgov_elections_demo_content/content/node/323fb108-c7e6-4ab8-89e1-8a2705ce6cfa.yml @@ -36,6 +36,9 @@ default: revision_translation_affected: - value: true + moderation_state: + - + value: published path: - alias: /election/general-election-july-2024/bicester-and-woodstock diff --git a/modules/localgov_elections_demo_content/content/node/40b48ccc-4694-4718-96ae-a47cbdba8728.yml b/modules/localgov_elections_demo_content/content/node/40b48ccc-4694-4718-96ae-a47cbdba8728.yml index 3fe2dfa..c00af03 100644 --- a/modules/localgov_elections_demo_content/content/node/40b48ccc-4694-4718-96ae-a47cbdba8728.yml +++ b/modules/localgov_elections_demo_content/content/node/40b48ccc-4694-4718-96ae-a47cbdba8728.yml @@ -36,6 +36,9 @@ default: revision_translation_affected: - value: true + moderation_state: + - + value: published path: - alias: /election/general-election-july-2024/oxford-west-and-abingdon diff --git a/modules/localgov_elections_demo_content/content/node/4d5aff55-8f5e-4195-acf0-a49cf259f84c.yml b/modules/localgov_elections_demo_content/content/node/4d5aff55-8f5e-4195-acf0-a49cf259f84c.yml index 0a9a067..6feddb3 100644 --- a/modules/localgov_elections_demo_content/content/node/4d5aff55-8f5e-4195-acf0-a49cf259f84c.yml +++ b/modules/localgov_elections_demo_content/content/node/4d5aff55-8f5e-4195-acf0-a49cf259f84c.yml @@ -36,6 +36,9 @@ default: revision_translation_affected: - value: true + moderation_state: + - + value: published path: - alias: /election/general-election-july-2024/banbury diff --git a/modules/localgov_elections_demo_content/content/node/5f652852-df67-4d5e-9e23-fc96c90a0f43.yml b/modules/localgov_elections_demo_content/content/node/5f652852-df67-4d5e-9e23-fc96c90a0f43.yml index 4a89297..855510e 100644 --- a/modules/localgov_elections_demo_content/content/node/5f652852-df67-4d5e-9e23-fc96c90a0f43.yml +++ b/modules/localgov_elections_demo_content/content/node/5f652852-df67-4d5e-9e23-fc96c90a0f43.yml @@ -36,6 +36,9 @@ default: revision_translation_affected: - value: true + moderation_state: + - + value: published path: - alias: /election/general-election-july-2024/oxford-east diff --git a/modules/localgov_elections_demo_content/content/node/7d910eb2-029f-4688-a060-0319dc888ca1.yml b/modules/localgov_elections_demo_content/content/node/7d910eb2-029f-4688-a060-0319dc888ca1.yml index 781e213..0a77d21 100644 --- a/modules/localgov_elections_demo_content/content/node/7d910eb2-029f-4688-a060-0319dc888ca1.yml +++ b/modules/localgov_elections_demo_content/content/node/7d910eb2-029f-4688-a060-0319dc888ca1.yml @@ -35,6 +35,9 @@ default: revision_translation_affected: - value: true + moderation_state: + - + value: published path: - alias: /election/general-election-july-2024/witney diff --git a/modules/localgov_elections_demo_content/content/node/dd93c0fa-53b1-49fa-8dc7-066b83ea3bcb.yml b/modules/localgov_elections_demo_content/content/node/dd93c0fa-53b1-49fa-8dc7-066b83ea3bcb.yml index 952d413..768902c 100644 --- a/modules/localgov_elections_demo_content/content/node/dd93c0fa-53b1-49fa-8dc7-066b83ea3bcb.yml +++ b/modules/localgov_elections_demo_content/content/node/dd93c0fa-53b1-49fa-8dc7-066b83ea3bcb.yml @@ -36,6 +36,9 @@ default: revision_translation_affected: - value: true + moderation_state: + - + value: published path: - alias: /election/general-election-july-2024/didcot-and-wantage diff --git a/modules/localgov_elections_demo_content/localgov_elections_demo_content.module b/modules/localgov_elections_demo_content/localgov_elections_demo_content.module new file mode 100644 index 0000000..a082a3b --- /dev/null +++ b/modules/localgov_elections_demo_content/localgov_elections_demo_content.module @@ -0,0 +1,25 @@ +condition('type', ['localgov_area_vote', 'localgov_election'], 'IN') + ->accessCheck(FALSE) + ->execute(); + $nodes = \Drupal::entityTypeManager() + ->getStorage('node') + ->loadMultiple($nids); + foreach ($nodes as $node) { + \Drupal::service('pathauto.generator')->updateEntityAlias($node, 'update'); + } + } +}