Skip to content

Commit bc52261

Browse files
committed
Added info on DPL pretix version
1 parent 1c20df1 commit bc52261

3 files changed

Lines changed: 34 additions & 7 deletions

File tree

dpl_pretix.services.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
services:
2+
_defaults:
3+
autowire: true
4+
25
logger.channel.dpl_pretix:
36
parent: logger.channel_base
47
arguments: ["dpl_pretix"]
58

69
Drupal\dpl_pretix\Settings:
7-
autowire: true
810

911
Drupal\dpl_pretix\EventDataHelper:
10-
autowire: true
1112

1213
Drupal\dpl_pretix\EntityHelper:
13-
autowire: true
1414
arguments:
1515
$logger: "@logger.channel.dpl_pretix"
1616

1717
Drupal\dpl_pretix\FormHelper:
18-
autowire: true
1918

2019
Drupal\dpl_pretix\PretixHelper:
21-
autowire: true

src/Form/SettingsForm.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
use Drupal\Core\Config\ImmutableConfig;
88
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
99
use Drupal\Core\Entity\EntityFieldManagerInterface;
10+
use Drupal\Core\Extension\InfoParser;
11+
use Drupal\Core\Extension\ModuleHandlerInterface;
1012
use Drupal\Core\Form\ConfigFormBase;
1113
use Drupal\Core\Form\FormStateInterface;
1214
use Drupal\Core\Language\LanguageManagerInterface;
@@ -50,6 +52,7 @@ public function __construct(
5052
private readonly LanguageManagerInterface $languageManager,
5153
private readonly EntityFieldManagerInterface $entityFieldManager,
5254
private readonly RoleStorageInterface $roleStorage,
55+
private readonly ModuleHandlerInterface $moduleHandler,
5356
private readonly Settings $settings,
5457
private readonly PretixHelper $pretixHelper,
5558
) {
@@ -71,6 +74,7 @@ public static function create(ContainerInterface $container): self {
7174
$container->get('language_manager'),
7275
$container->get('entity_field.manager'),
7376
$container->get('entity_type.manager')->getStorage('user_role'),
77+
$container->get('module_handler'),
7478
$settings,
7579
$pretixHelper,
7680
);
@@ -137,6 +141,28 @@ public function buildForm(array $form, FormStateInterface $form_state) {
137141
$this->buildFormEventNodes($form);
138142
$this->buildFormEventForm($form);
139143

144+
$form['module_info'] = [
145+
'#type' => 'container',
146+
];
147+
148+
try {
149+
$project = 'dpl_pretix';
150+
$module = $this->moduleHandler->getModule($project);
151+
$info = (new InfoParser())->parse($module->getFileInfo()
152+
->getPathname());
153+
154+
$info['project'] = $project;
155+
$form['module_info']['version'] = [
156+
'#markup' => $this->t('@name version: @version',
157+
['@name' => $info['name'], '@version' => $info['version'] ?? '👻'],
158+
['context' => 'dpl_pretix']
159+
),
160+
];
161+
}
162+
catch (\Exception) {
163+
// Silently ignore any errors.
164+
}
165+
140166
$form['admin'] = [
141167
'#type' => 'container',
142168

translations/dpl_pretix.da.po

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
msgid ""
44
msgstr ""
55
"Project-Id-Version: PROJECT VERSION\n"
6-
"POT-Creation-Date: 2026-01-30 09:39+0100\n"
7-
"PO-Revision-Date: 2026-01-30 09:39+0100\n"
6+
"POT-Creation-Date: 2026-02-04 08:11+0100\n"
7+
"PO-Revision-Date: 2026-02-04 08:14+0100\n"
88
"Last-Translator: NAME <EMAIL@ADDRESS>\n"
99
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
1010
"Language: da\n"
@@ -466,3 +466,6 @@ msgstr "pretix-arrangementstandarder"
466466
msgid "pretix webhook URL"
467467
msgstr "pretix-webhook-url"
468468

469+
msgctxt "dpl_pretix"
470+
msgid "@name version: @version"
471+
msgstr "@name-version: @version"

0 commit comments

Comments
 (0)