Skip to content
Open
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
10 changes: 9 additions & 1 deletion Services/News/classes/class.ilNewsForContextBlockGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ilNewsForContextBlockGUI extends ilBlockGUI
protected ilHelpGUI $help;
protected ilSetting $settings;
protected ilTabsGUI $tabs;
protected ilLogger $logger;

protected StandardGUIRequest $std_request;
protected InternalDomainService $domain;
Expand All @@ -68,6 +69,7 @@ public function __construct()
$this->help = $DIC["ilHelp"];
$this->settings = $DIC->settings();
$this->tabs = $DIC->tabs();
$this->logger = $DIC->logger()->news();

$locator = $DIC->news()->internal();
$this->std_request = $locator->gui()->standardRequest();
Expand Down Expand Up @@ -131,7 +133,13 @@ protected function preloadData(array $data): void

protected function getListItemForData(array $data): ?\ILIAS\UI\Component\Item\Item
{
$info = $this->getNewsForId($data[0]);
try {
$info = $this->getNewsForId($data[0]);
} catch (\Exception $e) {
$this->logger->error($e->getMessage());
return $this->ui->factory()->item()->standard($this->lng->txt('news_sorry_not_accessible_anymore'));
}


$props = [
$this->lng->txt('date') => $info['creation_date'] ?? ''
Expand Down