Skip to content

Commit 09ab006

Browse files
Merge pull request #6933 from christianbeeznest/GH-6926-2
Internal: Update titles/comments for show_tabs and show_tabs_per_role - refs #6926
2 parents ced008a + 2551703 commit 09ab006

File tree

2 files changed

+63
-3
lines changed

2 files changed

+63
-3
lines changed

src/CoreBundle/DataFixtures/SettingsCurrentFixtures.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,12 +584,12 @@ public static function getExistingSettings(): array
584584
'display' => [
585585
[
586586
'name' => 'show_tabs',
587-
'title' => 'Tabs in the header',
588-
'comment' => 'Check the tabs you want to see appear in the header. The unchecked tabs will appear on the right hand menu on the portal homepage and my courses page if these need to appear',
587+
'title' => 'Main menu entries',
588+
'comment' => 'Check the entrie you want to see appear in the main menu',
589589
],
590590
[
591591
'name' => 'show_tabs_per_role',
592-
'title' => 'Show tabs per role',
592+
'title' => 'Main menu entries per role',
593593
'comment' => 'Define header tabs visibility per role.',
594594
],
595595
[
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
/* For licensing terms, see /license.txt */
3+
4+
declare(strict_types=1);
5+
6+
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
7+
8+
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
9+
use Doctrine\DBAL\Schema\Schema;
10+
11+
final class Version20251021202800 extends AbstractMigrationChamilo
12+
{
13+
private const DEBUG = true;
14+
15+
public function getDescription(): string
16+
{
17+
return 'Update titles/comments for show_tabs and show_tabs_per_role and ensure they live under category "display".';
18+
}
19+
20+
private const UPDATES = [
21+
'show_tabs' => [
22+
'title' => 'Main menu entries',
23+
'comment' => 'Check the entrie you want to see appear in the main menu',
24+
],
25+
'show_tabs_per_role' => [
26+
'title' => 'Main menu entries per role',
27+
'comment' => 'Define header tabs visibility per role.',
28+
],
29+
];
30+
31+
public function up(Schema $schema): void
32+
{
33+
$conn = $this->connection;
34+
35+
foreach (self::UPDATES as $var => $meta) {
36+
$affected = $conn->executeStatement(
37+
"UPDATE settings
38+
SET title = ?, comment = ?, category = 'display'
39+
WHERE variable = ?",
40+
[$meta['title'], $meta['comment'], $var]
41+
);
42+
43+
$this->dbg(sprintf(
44+
"[UP] variable='%s' -> title='%s', comment='%s', category='display' (rows=%d)",
45+
$var, $meta['title'], $meta['comment'], $affected
46+
));
47+
48+
if ($affected === 0) {
49+
$this->dbg(sprintf("[WARN] No rows found for variable='%s' to update.", $var));
50+
}
51+
}
52+
}
53+
54+
private function dbg(string $msg): void
55+
{
56+
if (self::DEBUG) {
57+
error_log('[MIG][show_tabs_titles] ' . $msg);
58+
}
59+
}
60+
}

0 commit comments

Comments
 (0)