Also apply #2192 fix to document and comment modules; defend null

This commit is contained in:
Kijin Sung 2023-10-03 14:32:15 +09:00
parent ce3f5e98d2
commit 433103bf92
3 changed files with 7 additions and 10 deletions

View file

@ -119,12 +119,10 @@ class CommentModel extends Comment
} }
// Changing a language of pop-up menu // Changing a language of pop-up menu
$menus = Context::get('comment_popup_menu_list'); $menus = Context::get('comment_popup_menu_list') ?: [];
$menus_count = count($menus); foreach ($menus as $menu)
for($i = 0; $i < $menus_count; $i++)
{ {
$menus[$i]->str = lang($menus[$i]->str); $menu->str = lang($menu->str ?? '');
} }
// get a list of final organized pop-up menus // get a list of final organized pop-up menus

View file

@ -592,11 +592,10 @@ class DocumentModel extends Document
} }
} }
// Changing the language of pop-up menu // Changing the language of pop-up menu
$menus = Context::get('document_popup_menu_list'); $menus = Context::get('document_popup_menu_list') ?: [];
$menus_count = count($menus); foreach ($menus as $menu)
for($i=0;$i<$menus_count;$i++)
{ {
$menus[$i]->str = lang($menus[$i]->str); $menu->str = lang($menu->str ?? '');
} }
// Wanted to finally clean pop-up menu list // Wanted to finally clean pop-up menu list
$this->add('menus', $menus); $this->add('menus', $menus);

View file

@ -336,7 +336,7 @@ class MemberModel extends Member
$menus = Context::get('member_popup_menu_list') ?: []; $menus = Context::get('member_popup_menu_list') ?: [];
foreach ($menus as $menu) foreach ($menus as $menu)
{ {
$menu->str = lang($menu->str); $menu->str = lang($menu->str ?? '');
} }
// Get a list of finalized pop-up menu // Get a list of finalized pop-up menu
$this->add('menus', $menus); $this->add('menus', $menus);