Skip to content

Commit

Permalink
Multilanguage filters support added for smart menus
Browse files Browse the repository at this point in the history
  • Loading branch information
prasanna-lmsace committed Sep 16, 2023
1 parent b8c6de6 commit c41310c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion classes/smartmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ public function build($resetcache=false) {
// Moodle core custom menu logic.
'title' => '',
'url' => null,
'text' => $this->menu->title,
'text' => format_string($this->menu->title),
'key' => $this->menu->id,
'submenulink' => 1,
'itemtype' => 'submenu-link', // Used in user menus, to identify the menu type, "link" for submmenus.
Expand Down
11 changes: 11 additions & 0 deletions classes/table/smartmenus_items.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ public function __construct($menuid) {
$this->totalmenuitems = $DB->count_records('theme_boost_union_menuitems');
}

/**
* Title column.
*
* @param stdclass $row Data of the item.
* @return string Lanaguage formated title of item.
*/
public function col_title($row) {
// Return the title after filter.
return format_string($row->title);
}

/**
* Type column.
*
Expand Down
11 changes: 11 additions & 0 deletions classes/table/smartmenus_menus.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ public function __construct() {
$this->totalmenus = $DB->count_records('theme_boost_union_menus');
}

/**
* Title column.
*
* @param stdclass $row Data of the menu.
* @return string Lanaguage formated title of menu.
*/
public function col_title($row) {
// Return the title after filter.
return format_string($row->title);
}

/**
* Location column.
*
Expand Down
2 changes: 1 addition & 1 deletion smartmenus/items.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('smartmenus', 'theme_boost_union'));
if (isset($menu->title)) {
$menuheading = $menu->title;
$menuheading = format_string($menu->title);
$settingstitle = get_string('smartmenussettings', 'theme_boost_union');
$settingsurl = new moodle_url('/theme/boost_union/smartmenus/edit.php', array('id' => $menuid, 'sesskey' => sesskey()));
$menuheading .= html_writer::link($settingsurl,
Expand Down

0 comments on commit c41310c

Please sign in to comment.