Skip to content

Commit

Permalink
Merge pull request #395 from itk-dev/feature/project-page-fixtures
Browse files Browse the repository at this point in the history
Project fixtures
  • Loading branch information
yepzdk authored Apr 25, 2024
2 parents afbc3ab + 2440a50 commit c7dfab2
Show file tree
Hide file tree
Showing 18 changed files with 498 additions and 88 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

* [PR-395](https://github.com/itk-dev/hoeringsportal/pull/395)
Project fixtures
* [PR-398](https://github.com/itk-dev/hoeringsportal/pull/398)
Added Deskpro test data
* [pr-399](https://github.com/itk-dev/hoeringsportal/pull/399)
Expand Down
7 changes: 5 additions & 2 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
<arg value="p"/>

<arg name="extensions" value="php,module,inc,install,test,profile,theme,css,info,txt,yml"/>
<config name="drupal_core_version" value="8"/>
<rule ref="./vendor/drupal/coder/coder_sniffer/Drupal/ruleset.xml">

<config name="drupal_core_version" value="10"/>

<rule ref="Drupal">
<!-- <exclude name="Drupal.Files.TxtFileLineLength.TooLong"/> -->
<!-- We want to be able to use "package" and "version" in our custom modules -->
<exclude name="Drupal.InfoFiles.AutoAddedKeys.Project"/>
<exclude name="Drupal.InfoFiles.AutoAddedKeys.Version"/>
</rule>
<rule ref="Squiz.Strings.DoubleQuoteUsage.NotRequired"/>
</ruleset>
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,41 @@ class MapFixture extends AbstractFixture implements DependentFixtureInterface, F
public function load() {

$field_map_configuration_data = [
"map" => [
"maxZoomLevel" => 0,
"minZoomLevel" => 20,
"view" => [
"zoomLevel" => 5,
"x" => 659519,
"y" => 6151191,
'map' => [
'maxZoomLevel' => 0,
'minZoomLevel' => 20,
'view' => [
'zoomLevel' => 5,
'x' => 659519,
'y' => 6151191,
],
"layer" => [
'layer' => [
[
"namedlayer" => "#dk_standard",
'namedlayer' => '#dk_standard',
],
[
"features" => TRUE,
"features_host" => "../data/boernehaver.json",
"features_dataType" => "json",
"features_type" => "Point",
"features_style" => [
"namedstyle" => "#011",
'features' => TRUE,
'features_host' => '../data/boernehaver.json',
'features_dataType' => 'json',
'features_type' => 'Point',
'features_style' => [
'namedstyle' => '#011',
],
"template_info" => "<div class='widget-hoverbox-title'>{{navn}}</div><div class=\"widget-hoverbox-sub\"><% if (navn === 'Landsbybørnehaven') { %><div><%= navn %></div><% } %><div>{{Adresse}}, {{Postnr}} {{By}}</div><div><a target=\"blank\" href=\"{{SE_MERE}}\">Hjemmeside</a></div><% if (navn === 'Regnbuen') { %><div>Dette er en meget lang tekst hvor der kan stå en masse, men det er ikke sikkert at der er plads til det på kortet</div><% } %></div>",
"name" => "Børnehaver",
"type" => "geojson",
'template_info' => "<div class='widget-hoverbox-title'>{{navn}}</div><div class=\"widget-hoverbox-sub\"><% if (navn === 'Landsbybørnehaven') { %><div><%= navn %></div><% } %><div>{{Adresse}}, {{Postnr}} {{By}}</div><div><a target=\"blank\" href=\"{{SE_MERE}}\">Hjemmeside</a></div><% if (navn === 'Regnbuen') { %><div>Dette er en meget lang tekst hvor der kan stå en masse, men det er ikke sikkert at der er plads til det på kortet</div><% } %></div>",
'name' => 'Børnehaver',
'type' => 'geojson',
],
],
"controls" => [
'controls' => [
[
"info" => [
"disable" => FALSE,
"eventtype" => "click",
"multifeature" => 10,
"type" => "cloud",
'info' => [
'disable' => FALSE,
'eventtype' => 'click',
'multifeature' => 10,
'type' => 'cloud',
],
"overlay" => [
"disable" => FALSE,
'overlay' => [
'disable' => FALSE,
],
],
],
Expand All @@ -66,13 +66,13 @@ public function load() {
'type' => 'page_map',
'title' => 'page_map - Heste Kortet',
'status' => NodeInterface::PUBLISHED,
"field_pretix_event_settings" =>
'field_pretix_event_settings' =>
[
'template_event' => 'testvej 2',
'synchronize_event' => FALSE,
],
"field_map_type" => [],
"field_map_configuration" => json_encode($field_map_configuration_data),
'field_map_type' => [],
'field_map_configuration' => json_encode($field_map_configuration_data),
]);
$this->addReference('page_map:fixture-1', $node);
$node->save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Drupal\content_fixtures\Fixture\FixtureGroupInterface;
use Drupal\hoeringsportal_citizen_proposal_fixtures\Fixture\CitizenProposalLandingPageFixture;
use Drupal\hoeringsportal_hearing_fixtures\Fixture\HearingLandingPageFixture;
use Drupal\hoeringsportal_project_fixtures\Fixture\ProjectLandingPageFixture;
use Drupal\menu_link_content\Entity\MenuLinkContent;

/**
Expand All @@ -22,23 +23,20 @@ class MenuItemFixture extends AbstractFixture implements DependentFixtureInterfa
* @throws \Drupal\Core\Entity\EntityStorageException
*/
public function load() {
$hearingPage = $this->getReference('node:landing_page:Hearings');
MenuLinkContent::create([
'title' => $hearingPage->title->value,
'link' => ['uri' => 'entity:node/' . $hearingPage->id()],
'menu_name' => 'main',
'expanded' => FALSE,
'weight' => 0,
])->save();

$citizenProposalPage = $this->getReference('node:landing_page:Proposals');
MenuLinkContent::create([
'title' => $citizenProposalPage->title->value,
'link' => ['uri' => 'entity:node/' . $citizenProposalPage->id()],
'menu_name' => 'main',
'expanded' => FALSE,
'weight' => 3,
])->save();
foreach ([
'node:landing_page:Hearings',
'node:landing_page:Proposals',
'node:landing_page:Projects',
] as $weight => $name) {
$page = $this->getReference($name);
MenuLinkContent::create([
'title' => $page->title->value,
'link' => ['uri' => 'entity:node/' . $page->id()],
'menu_name' => 'main',
'expanded' => FALSE,
'weight' => $weight,
])->save();
}
}

/**
Expand All @@ -48,6 +46,7 @@ public function getDependencies() {
return [
HearingLandingPageFixture::class,
CitizenProposalLandingPageFixture::class,
ProjectLandingPageFixture::class,
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function load() {
'type' => 'signup_link',
'field_signup_link' => [
[
"field_signup_link_uri" =>
'field_signup_link_uri' =>
[
'title' => 'mmmmm',
'field_signup_link_options' => ['value' => 'test'],
Expand Down Expand Up @@ -64,11 +64,36 @@ public function load() {
'field_content_list' => [
'target_id' => 'all_citizen_proposals',
'display_id' => 'default',
'data' => '',
],
'field_list_title' => 'Indholdsliste1',
'field_list_title' => 'All citizen proposals',
]);
$paragraph->save();
$this->addReference('paragraph:content_list:content_list1', $paragraph);
$this->addReference('paragraph:content_list:all_citizen_proposals', $paragraph);

$paragraph = Paragraph::create([
'type' => 'content_list',
'field_content_list' => [
'target_id' => 'all_hearings',
'display_id' => 'default',
'data' => '',
],
'field_list_title' => 'All hearings',
]);
$paragraph->save();
$this->addReference('paragraph:content_list:all_hearings', $paragraph);

$paragraph = Paragraph::create([
'type' => 'content_list',
'field_content_list' => [
'target_id' => 'all_public_meetings',
'display_id' => 'default',
'data' => '',
],
'field_list_title' => 'All public meetings',
]);
$paragraph->save();
$this->addReference('paragraph:content_list:all_public_meetings', $paragraph);

$paragraph = Paragraph::create([
'type' => 'info_box',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ public function load() {
'type' => 'project',
'title' => 'project - Projekt Tidslinje',
'status' => NodeInterface::PUBLISHED,
"field_description" => "field_description - Her forklare jeg noget",
"field_project_finish" => date('d-m-Y', $tenDaysLater),
"field_project_start" => date('d-m-Y', $today),
"field_timeline_items" =>
['target_id' => $this->getReference('paragraph:content_list:content_list1')->id()],
'field_description' => 'field_description - Her forklare jeg noget',
'field_project_finish' => date('d-m-Y', $tenDaysLater),
'field_project_start' => date('d-m-Y', $today),
]);
$this->addReference('project:fixture-1', $node);
$node->save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,32 @@ public function load() {
'type' => 'public_meeting',
'title' => 'public_meeting - Heste Meeting',
'status' => NodeInterface::PUBLISHED,
"field_area" => ['tid' => date("Y-m-d", 2222222322222)],
"field_cancelled_date" => date("Y-m-d", 1283166912),
"field_cancelled_text" => 'field_cancelled_text' ,
"field_contact" => 'field_contact' ,
"field_content_state" => 'active' ,
"field_description" => 'field_description' ,
"field_email_address" => '[email protected]' ,
"field_first_meeting_time" => date("Y-m-d", 1283166912) ,
"field_hidden_signup" => 4 ,
"field_last_meeting_time" => date("Y-m-d", 1283166912) ,
"field_last_meeting_time_end" => date("Y-m-d", 2222222322222),
"field_media_document" => ['target_id' => $this->getReference('media_library:Fil:MTM')->id()],
"field_media_image_single" => ['target_id' => $this->getReference('media_library:Billede:MTM')->id()] ,
"field_pretix_event_settings" =>
'field_area' => ['tid' => date('Y-m-d', 2222222322222)],
'field_cancelled_date' => date('Y-m-d', 1283166912),
'field_cancelled_text' => 'field_cancelled_text' ,
'field_contact' => 'field_contact' ,
'field_content_state' => 'active' ,
'field_description' => 'field_description' ,
'field_email_address' => '[email protected]' ,
'field_first_meeting_time' => date('Y-m-d', 1283166912) ,
'field_hidden_signup' => 4 ,
'field_last_meeting_time' => date('Y-m-d', 1283166912) ,
'field_last_meeting_time_end' => date('Y-m-d', 2222222322222),
'field_media_document' => ['target_id' => $this->getReference('media_library:Fil:MTM')->id()],
'field_media_image_single' => ['target_id' => $this->getReference('media_library:Billede:MTM')->id()] ,
'field_pretix_event_settings' =>
['template_event' => 'testvej 1', 'synchronize_event' => FALSE],
"field_email" => '[email protected] ',
"field_project_reference" => 'field_project_reference' ,
"field_registration_deadline" => ['value' => 'word'],
'field_email' => '[email protected] ',
'field_project_reference' => 'field_project_reference' ,
'field_registration_deadline' => ['value' => 'word'],
'field_section' =>
[
'target_id' => $this->getReference('paragraph:content_list:content_list1')->id(),
'target_revision_id' => $this->getReference('paragraph:content_list:content_list1')->getRevisionId(),
'target_id' => $this->getReference('paragraph:content_list:all_public_meetings')->id(),
'target_revision_id' => $this->getReference('paragraph:content_list:all_public_meetings')->getRevisionId(),
],
"field_signup_selection" => 'field_signup_selection' ,
"field_signup_text" => 'field_signup_text' ,
"field_teaser" => 'field_teaser' ,
'field_signup_selection' => 'field_signup_selection' ,
'field_signup_text' => 'field_signup_text' ,
'field_teaser' => 'field_teaser' ,
]);
$this->addReference('public_meeting:fixture-1', $node);
$node->save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public function load() {
'type' => 'static_page',
'title' => 'Statisk side 223232323',
'status' => NodeInterface::PUBLISHED,
"field_media_image_single" => ['target_id' => $this->getReference('media_library:Billede:MTM')->id()],
"field_teaser" => 'field teaser',
"field_sidebar" => ['value' => 'Sidebar ?'],
"field_teaser_color" => '#fff',
'field_media_image_single' => ['target_id' => $this->getReference('media_library:Billede:MTM')->id()],
'field_teaser' => 'field teaser',
'field_sidebar' => ['value' => 'Sidebar ?'],
'field_teaser_color' => '#fff',
]);
$this->addReference('static_page:fixture-1', $node);
$node->save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public function load() {
'field_media_image_single' => ['target_id' => $this->getReference('media:Large2')->id()],
'field_section' => [
[
'target_id' => $this->getReference('paragraph:content_list:content_list1')->id(),
'target_revision_id' => $this->getReference('paragraph:content_list:content_list1')->getRevisionId(),
'target_id' => $this->getReference('paragraph:content_list:all_citizen_proposals')->id(),
'target_revision_id' => $this->getReference('paragraph:content_list:all_citizen_proposals')->getRevisionId(),
],
],
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function hoeringsportal_data_field_group_form_process_build_alter(array &$elemen
* Implements hook_views_pre_render().
*/
function hoeringsportal_data_views_pre_render(ViewExecutable $view) {
if ($view->id() == "heyloyalty_feed" && $view->current_display == 'rest_export_1') {
if ($view->id() == 'heyloyalty_feed' && $view->current_display == 'rest_export_1') {
if (empty($view->result)) {
// Add an empty result for views to use field empty results.
$emptyResult = new ResultRow([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ public function load() {
'title' => 'Høringer',
'field_teaser' => [
'value' => <<<'BODY'
Her har du mulighed for at gøre opmærksom på dine synspunkter om en konkret høringssag.
Her har du mulighed for at gøre opmærksom på dine synspunkter om en konkret høringssag.
VIGTIGT: Der kan gå længere tid inden høringssvar bliver vist på siden. Dit svar er modtaget, når du har fået en kvitteringsmail.
BODY
],
'field_media_image_single' => ['target_id' => $this->getReference('media:Large2')->id()],
'field_section' => [
[
'target_id' => $this->getReference('paragraph:content_list:content_list1')->id(),
'target_revision_id' => $this->getReference('paragraph:content_list:content_list1')->getRevisionId(),
'target_id' => $this->getReference('paragraph:content_list:all_hearings')->id(),
'target_revision_id' => $this->getReference('paragraph:content_list:all_hearings')->getRevisionId(),
],
[
'target_id' => $this->getReference('paragraph:teaser_row:teaser_row1')->id(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Hoeringsportal project fixtures
type: module
description: 'Provides project fixtures for the site.'
core_version_requirement: ^10
package: ITK
dependencies:
- content_fixtures:content_fixtures
- hoeringsportal_base_fixtures:hoeringsportal_base_fixtures
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
services:
Drupal\hoeringsportal_project_fixtures\Fixture\BlockContentFixture:
tags:
- { name: content_fixture }

Drupal\hoeringsportal_project_fixtures\Fixture\ProjectCategoryFixture:
tags:
- { name: content_fixture }

Drupal\hoeringsportal_project_fixtures\Fixture\ProjectLandingPageFixture:
tags:
- { name: content_fixture }

Drupal\hoeringsportal_project_fixtures\Fixture\ProjectMainPageFixture:
tags:
- { name: content_fixture }

Drupal\hoeringsportal_project_fixtures\Fixture\ProjectPageFixture:
tags:
- { name: content_fixture }
Loading

0 comments on commit c7dfab2

Please sign in to comment.