Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Drop Event.language #4271

Merged
merged 1 commit into from
Mar 25, 2025
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).

### Removed

- Drop `Event.language` (#4271)
- Drop the event language from the FE list and single view (#4270)
- Drop the country column from the FE list views (#4269)
- Remove the language selector from the selector widget (#4262, #4268)
Expand Down
28 changes: 0 additions & 28 deletions Classes/BackEnd/TceForms.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,6 @@
*/
class TceForms
{
/**
* Creates the values for a language selector in the TCA, using the alpha 2 codes as array keys.
*
* @param array[] $parameters
*/
public function createLanguageSelector(array &$parameters): void
{
$items = [['', '']];

/** @var string[] $language */
foreach (self::findAllLanguages() as $language) {
$items[] = [$language['lg_name_local'], $language['lg_iso_2']];
}

$parameters['items'] = $items;
}

/**
* Creates the values for a country selector in the TCA, using the alpha 2 codes as array keys.
*
Expand All @@ -49,17 +32,6 @@ public function createCountrySelector(array &$parameters): void
$parameters['items'] = $items;
}

/**
* @return array<int, array<string, string|int>>
*/
private static function findAllLanguages(): array
{
$table = 'static_languages';

return self::getConnectionForTable($table)
->select(['*'], $table, [], [], ['lg_name_local' => 'ASC'])->fetchAllAssociative();
}

/**
* @return array<int, array<string, string|int>>
*/
Expand Down
62 changes: 0 additions & 62 deletions Classes/OldModel/LegacyEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -781,50 +781,6 @@ public function getLanguageKeySuffixForType(string $speakerType): string
return $this->getSpeakerBag($speakerType)->count() > 1 ? $speakerType : ($speakerType . '_single_unknown');
}

public function hasLanguage(): bool
{
return $this->hasRecordPropertyString('language');
}

/**
* Returns the localized name of the language for this event. In the case
* that no language is selected, an empty string will be returned.
*
* @return string the localized name of the language of this event or
* an empty string if no language is set
*/
public function getLanguageName(): string
{
$language = '';
if ($this->hasLanguage()) {
$language = $this->getLanguageNameFromIsoCode(
$this->getRecordPropertyString('language')
);
}
return $language;
}

/**
* Returns the language ISO code for this event. In the case that no
* language is selected, an empty string will be returned.
*
* @return string the ISO code of the language of this event or an empty string if no language is set
*/
public function getLanguage(): string
{
return $this->getRecordPropertyString('language');
}

/**
* Sets the language ISO code for this event.
*
* @param string $language the ISO code of the language for this event to set, may be empty
*/
public function setLanguage(string $language): void
{
$this->setRecordPropertyString('language', $language);
}

/**
* Gets our regular price as a string containing amount and currency. If
* no regular price has been set, this will be "free".
Expand Down Expand Up @@ -1175,24 +1131,6 @@ public function getNumberOfPaymentMethods(): int
return $number;
}

/**
* Returns the name of the requested language from the static info tables.
* If no language with this ISO code could not be found in the database,
* an empty string is returned instead.
*
* @param string $isoCode the ISO 639 alpha-2 code of the language
*
* @return string the short local name of the language or an empty string if the language could not be found
*/
public function getLanguageNameFromIsoCode(string $isoCode): string
{
$table = 'static_languages';
$data = self::getConnectionForTable($table)
->select(['lg_name_local'], $table, ['lg_iso_2' => $isoCode])->fetchAssociative();

return \is_array($data) ? (string)$data['lg_name_local'] : '';
}

/**
* Returns the type of the record. This is one out of the following values:
* 0 = single event (and default value of older records)
Expand Down
17 changes: 2 additions & 15 deletions Configuration/TCA/tx_seminars_seminars.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use OliverKlee\Seminars\BackEnd\TceForms;
use OliverKlee\Seminars\Domain\Model\Event\EventDateInterface;
use OliverKlee\Seminars\Domain\Model\Event\EventInterface;
use OliverKlee\Seminars\Seo\SlugGenerator;
Expand Down Expand Up @@ -525,18 +524,6 @@
],
],
],
'language' => [
'exclude' => 1,
'label' => 'LLL:EXT:seminars/Resources/Private/Language/locallang_db.xlf:tx_seminars_seminars.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'itemsProcFunc' => TceForms::class . '->createLanguageSelector',
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
],
],
'price_regular' => [
'exclude' => 1,
'label' => 'LLL:EXT:seminars/Resources/Private/Language/locallang_db.xlf:tx_seminars_seminars.price_regular',
Expand Down Expand Up @@ -1038,7 +1025,7 @@
'types' => [
EventInterface::TYPE_SINGLE_EVENT => [
'showitem' =>
'--div--;LLL:EXT:seminars/Resources/Private/Language/locallang_db.xlf:tx_seminars_seminars.divLabelGeneral, object_type, title, uid, slug, subtitle, image, categories, teaser, description, event_type, language, accreditation_number, credit_points, details_page, additional_information, checkboxes, uses_terms_2, cancelled, automatic_confirmation_cancelation, notes, ' .
'--div--;LLL:EXT:seminars/Resources/Private/Language/locallang_db.xlf:tx_seminars_seminars.divLabelGeneral, object_type, title, uid, slug, subtitle, image, categories, teaser, description, event_type, accreditation_number, credit_points, details_page, additional_information, checkboxes, uses_terms_2, cancelled, automatic_confirmation_cancelation, notes, ' .
'--div--;LLL:EXT:seminars/Resources/Private/Language/locallang_db.xlf:tx_seminars_seminars.divLabelPlaceTime, event_format, webinar_url, begin_date, end_date, timeslots, begin_date_registration, deadline_registration, deadline_early_bird, deadline_unregistration, place, room, ' .
'--div--;LLL:EXT:seminars/Resources/Private/Language/locallang_db.xlf:tx_seminars_seminars.divLabelSpeakers, speakers, partners, tutors, leaders, ' .
'--div--;LLL:EXT:seminars/Resources/Private/Language/locallang_db.xlf:tx_seminars_seminars.divLabelOrganizers, organizers, organizing_partners, event_takes_place_reminder_sent, cancelation_deadline_reminder_sent, ' .
Expand All @@ -1058,7 +1045,7 @@
],
EventInterface::TYPE_EVENT_DATE => [
'showitem' =>
'--div--;LLL:EXT:seminars/Resources/Private/Language/locallang_db.xlf:tx_seminars_seminars.divLabelGeneral, object_type, title, uid, topic, slug, language, accreditation_number, details_page, cancelled, automatic_confirmation_cancelation, checkboxes, notes, ' .
'--div--;LLL:EXT:seminars/Resources/Private/Language/locallang_db.xlf:tx_seminars_seminars.divLabelGeneral, object_type, title, uid, topic, slug, accreditation_number, details_page, cancelled, automatic_confirmation_cancelation, checkboxes, notes, ' .
'--div--;LLL:EXT:seminars/Resources/Private/Language/locallang_db.xlf:tx_seminars_seminars.divLabelPlaceTime, event_format, webinar_url, begin_date, end_date, timeslots, begin_date_registration, deadline_registration, deadline_early_bird, deadline_unregistration, expiry, place, room, ' .
'--div--;LLL:EXT:seminars/Resources/Private/Language/locallang_db.xlf:tx_seminars_seminars.divLabelSpeakers, speakers, partners, tutors, leaders, ' .
'--div--;LLL:EXT:seminars/Resources/Private/Language/locallang_db.xlf:tx_seminars_seminars.divLabelOrganizers, organizers, organizing_partners, event_takes_place_reminder_sent, cancelation_deadline_reminder_sent, ' .
Expand Down
3 changes: 0 additions & 3 deletions Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@
<trans-unit id="tx_seminars_seminars.time">
<source>Time</source>
</trans-unit>
<trans-unit id="tx_seminars_seminars.language">
<source>Language</source>
</trans-unit>
<trans-unit id="tx_seminars_seminars.accreditation_number">
<source>Accreditation number</source>
</trans-unit>
Expand Down
Loading