def core__generate_menu_item key, values, module_name
      menu_item = {}
      menu_item[:key] = key
      menu_item[:title] = values[:title] ? core__get_menu_title_translation(values[:title], module_name) : 'Undefined'
      menu_item[:icon] = values[:icon] ? values[:icon] : 'check-circle'
      menu_item[:url] = values[:url] ? values[:url] : ''
      menu_item[:position] = values[:position] ? values[:position] : 999
      menu_item[:permission_min] = values[:permission_min] ? values[:permission_min] : 0
      menu_item[:permission_max] = values[:permission_max] ? values[:permission_max] : 999
      menu_item[:sub_items] = []

      if values[:sub_items]
        values[:sub_items].each do |key, value|
          menu_item[:sub_items].push(core__generate_menu_sub_item(key, value, module_name))
        end
      end

      return menu_item
    end
def core__generate_menu_item key, values, module_name
      menu_item = {}
      menu_item[:key] = key
      menu_item[:title] = values[:title] ? core__get_menu_title_translation(values[:title], module_name) : 'Undefined'
      menu_item[:icon] = values[:icon] ? values[:icon] : 'check-circle'
      menu_item[:url] = values[:url] ? values[:url] : ''
      menu_item[:position] = values[:position] ? values[:position] : 999
      menu_item[:permission_min] = values[:permission_min] ? values[:permission_min] : 0
      menu_item[:permission_max] = values[:permission_max] ? values[:permission_max] : 999
      menu_item[:sub_items] = []

      if values[:sub_items]
        values[:sub_items].each do |key, value|
          menu_item[:sub_items].push(core__generate_menu_sub_item(key, value, module_name))
        end
      end

      return menu_item
    end
This function create a correct menu item object for the menu.