Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
uuid: dbc3e84c-70c2-4783-ad25-fb61d2226979
langcode: en
status: true
dependencies:
config:
- field.storage.paragraph.field_api_url
- paragraphs.paragraphs_type.event_list
module:
- link
id: paragraph.event_list.field_api_url
field_name: field_api_url
entity_type: paragraph
bundle: event_list
label: 'Api URL'
description: 'Add URL from tapahtumat.hel.fi to form a list of events. Example URL: https://tapahtumat.hel.fi/fi/events?categories=museum. If you want to use the location filter, the URL should contain the IDs of all relevant locations. For example: &places=tprek:123,tprek:456'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
title: 0
link_type: 16
field_type: link
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
uuid: e3e806c9-2f10-4424-b3e2-bab97148acf6
langcode: en
status: true
dependencies:
module:
- link
- paragraphs
id: paragraph.field_api_url
field_name: field_api_url
entity_type: paragraph
type: link
settings: { }
module: link
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
21 changes: 1 addition & 20 deletions modules/helfi_react_search/helfi_react_search.install
Original file line number Diff line number Diff line change
Expand Up @@ -270,30 +270,11 @@ function helfi_react_search_update_9016() : void {

assert($paragraph instanceof EventList);

// @todo delete field_api_url when this functionality is validated.
if ($updater->migrateApiUrl($paragraph)) {
$paragraph->save();
}
}

$change = [
'paragraph' => [
'field_api_url' => [
'event_list',
],
],
];

foreach ($change as $entityType => $fieldNames) {
foreach ($fieldNames as $fieldName => $bundles) {
// Delete field definition.
foreach ($bundles as $bundle) {
FieldConfig::loadByName($entityType, $bundle, $fieldName)?->delete();
}

// Delete storage config.
FieldStorageConfig::loadByName($entityType, $fieldName)?->delete();
}
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Drupal\Tests\helfi_react_search\Kernel;

use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\helfi_react_search\DTO\LinkedEventsItem;
use Drupal\helfi_react_search\Entity\EventList;
use Drupal\helfi_react_search\Enum\EventCategory;
Expand Down Expand Up @@ -50,20 +48,6 @@ public function setUp(): void {

$this->installEntitySchema('paragraph');
$this->installConfig('helfi_react_search');

// Create legacy field.
FieldStorageConfig::create([
'field_name' => 'field_api_url',
'entity_type' => 'paragraph',
'type' => 'link',
'cardinality' => 1,
])->save();
FieldConfig::create([
'field_name' => 'field_api_url',
'label' => 'A test field',
'entity_type' => 'paragraph',
'bundle' => 'event_list',
])->save();
}

/**
Expand Down