Skip to content

Commit

Permalink
ENH Allow disabling of help_links
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Sep 4, 2023
1 parent 714c773 commit 325d87c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
16 changes: 9 additions & 7 deletions code/LeftAndMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -1889,13 +1889,15 @@ public function getHelpLinks()
}
});

foreach ($helpLinks as $key => $value) {
$translationKey = str_replace(' ', '', $key ?? '');

$formattedLinks[] = [
'Title' => _t(__CLASS__ . '.' . $translationKey, $key),
'URL' => $value
];
if ($helpLinks) {
foreach ($helpLinks as $key => $value) {
$translationKey = str_replace(' ', '', $key ?? '');

$formattedLinks[] = [
'Title' => _t(__CLASS__ . '.' . $translationKey, $key),
'URL' => $value
];
}
}

return ArrayList::create($formattedLinks);
Expand Down
7 changes: 7 additions & 0 deletions tests/php/LeftAndMainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ public function testGetHelpLinks()
$this->assertEquals('www.silverstripe.org', $silverstripeLink['URL']);
}

public function testDisableHelpLinks()
{
Config::modify()->set(LeftAndMain::class, 'help_links', false);
$helpLinks = LeftAndMain::singleton()->getHelpLinks();
$this->assertCount(0, $helpLinks);
}

/**
* @dataProvider provideTestCMSVersionNumber
*/
Expand Down

0 comments on commit 325d87c

Please sign in to comment.