Skip to content

Commit

Permalink
Merge pull request #809 from City-of-Helsinki/UHF-10079
Browse files Browse the repository at this point in the history
UHF-10079: Support infofinland
  • Loading branch information
hyrsky authored Sep 20, 2024
2 parents be80f74 + 1246701 commit 3a3d6c2
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"drupal/media_entity_file_replace": "^1.0",
"drupal/menu_block_current_language": "^2.0",
"drupal/menu_link_attributes": "^1.2",
"drupal/metatag": "^1.16",
"drupal/metatag": "^2",
"drupal/oembed_providers": "^2.0",
"drupal/paragraphs": "^1.12",
"drupal/paragraphs_asymmetric_translation_widgets": "^1.0",
Expand Down
5 changes: 0 additions & 5 deletions drush.services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ services:
arguments: ['@entity_type.manager', '@database']
tags:
- { name: drush.command }
helfi_platform_config.remove_non_helsinki_tpr_units_commands:
class: \Drupal\helfi_platform_config\Commands\RemoveNonHelsinkiTPRUnitsCommands
arguments: ['@entity_type.manager', '@content_lock']
tags:
- { name: drush.command }

helfi_platform_config.major_update_command:
class: Drupal\helfi_platform_config\Commands\MajorUpdateCommands
Expand Down
2 changes: 0 additions & 2 deletions helfi_platform_config.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ core_version_requirement: ^9 || ^10
dependencies:
- drupal:language
- drupal:views
# @todo Remove this.
- content_lock:content_lock
- helfi_api_base:helfi_api_base
- config_rewrite:config_rewrite
- menu_block_current_language:menu_block_current_language
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ tags:
canonical_url: '[node:url]'
article_modified_time: '[node:changed:html_datetime]'
article_published_time: '[node:created:html_datetime]'
content_language: '[node:langcode]'
og_title: '[node:title]'
og_description: '[node:lead-in]'
og_updated_time: '[node:changed:html_datetime]'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ id: tpr_service
label: 'TPR - Service'
tags:
canonical_url: '[tpr_service:url]'
content_language: '[tpr_service:langcode]'
description: '[tpr_service:description:summary]'
title: '[tpr_service:label] | [site:page-title-suffix]'
article_modified_time: '[tpr_service:changed:html_datetime]'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ id: tpr_unit
label: 'TPR - Unit'
tags:
canonical_url: '[tpr_unit:url]'
content_language: '[tpr_unit:langcode]'
description: '[tpr_unit:description:summary]'
title: '[tpr_unit:label] | [site:page-title-suffix]'
article_modified_time: '[tpr_unit:changed:html_datetime]'
Expand Down
1 change: 1 addition & 0 deletions modules/helfi_tpr_config/helfi_tpr_config.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ dependencies:
- 'views:views'
- 'views_bulk_edit:views_bulk_edit'
- 'views_bulk_operations:views_bulk_operations'
- 'content_lock:content_lock'
'interface translation project': helfi_tpr_config
'interface translation server pattern': modules/contrib/helfi_platform_config/modules/helfi_tpr_config/translations/%language.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@

declare(strict_types=1);

namespace Drupal\helfi_platform_config\Commands;
namespace Drupal\helfi_tpr_config\Drush\Commands;

use Drupal\content_lock\ContentLock\ContentLock;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drush\Attributes\Command;
use Drush\Commands\AutowireTrait;
use Drush\Commands\DrushCommands;
use Symfony\Component\DependencyInjection\Attribute\Autowire;

/**
* A Drush command file.
*/
final class RemoveNonHelsinkiTPRUnitsCommands extends DrushCommands {

use StringTranslationTrait;
use AutowireTrait;

/**
* Constructs a new instance.
Expand All @@ -26,14 +30,14 @@ final class RemoveNonHelsinkiTPRUnitsCommands extends DrushCommands {
*/
public function __construct(
protected EntityTypeManagerInterface $entityTypeManager,
#[Autowire(service: 'content_lock')]
protected ContentLock $contentLock,
) {}

/**
* Removes all the TPR Unit entities which are not located in Helsinki.
*
* @command helfi:remove-non-helsinki-tpr-units
*/
#[Command(name: 'helfi:remove-non-helsinki-tpr-units')]
public function remove() : void {
// Get TPR Unit entities that DON'T have "Helsinki" or "Helsingfors" in
// their 'address__locality' field.
Expand All @@ -52,7 +56,7 @@ public function remove() : void {
/** @var \Drupal\helfi_tpr\Entity\Unit $unit */
$unit = $this->entityTypeManager->getStorage('tpr_unit')->load($unit_id);

$this->output()->writeln($this->t('Deleting "@unit_label"', ['@unit_label' => $unit->label()]));
$this->output()->writeln((string) $this->t('Deleting "@unit_label"', ['@unit_label' => $unit->label()]));

// Release content lock if needed.
if ($this->contentLock->fetchLock($unit->id(), $unit->language()->getId(), entity_type: 'tpr_unit')) {
Expand Down

0 comments on commit 3a3d6c2

Please sign in to comment.