The admin panel shown by the Admin entry of the tab menu: a sidebar of page buttons and the page that is currently open. Pages are added from the AddAdminMenuItems hook with add_panel, may require a permission, and are created through the theme when their button is clicked.

Summary

Methods

Registers a page and adds a sidebar button that opens it.
Returns the size of the admin panel, scaled to the screen.
Init()client
Sizes and centers the admin panel, creates its sidebar and lets plugins add their pages through the AddAdminMenuItems hook.
Closes the current page and opens the one with the given ID, provided the local player has the permission it requires.
Draws the card of the panel and the divider between the sidebar and the page.
Lets the active theme draw over the panel through its AdminPanelPaintOver hook.
Unregisters a page.
Slides the sidebar out of view and shows a back button, or restores the normal layout.

Methods

PANEL:add_panel(id, title, permission, ...)

client plugins/admin/plugin/views/cl_admin.lua:67

Registers a page and adds a sidebar button that opens it.

Parameters

  • id String page ID; must match a panel registered with the theme
  • title String button text
  • permission String optional, defaults to nil permission needed to open the page
  • ... Vararg extra arguments passed to Theme.create_panel when the page is opened

PANEL:get_menu_size()

client plugins/admin/plugin/views/cl_admin.lua:168

Returns the size of the admin panel, scaled to the screen.

Returns

  • Number width
  • Number height

Sizes and centers the admin panel, creates its sidebar and lets plugins add their pages through the AddAdminMenuItems hook.

PANEL:open_panel(id)

client plugins/admin/plugin/views/cl_admin.lua:103

Closes the current page and opens the one with the given ID, provided the local player has the permission it requires. The button of the page becomes the active one.

Parameters

  • id String page ID

Draws the card of the panel and the divider between the sidebar and the page.

Parameters

  • w Number panel width
  • h Number panel height

PANEL:PaintOver(w, h)

client plugins/admin/plugin/views/cl_admin.lua:58

Lets the active theme draw over the panel through its AdminPanelPaintOver hook.

Parameters

  • w Number panel width
  • h Number panel height

PANEL:remove_panel(id)

client plugins/admin/plugin/views/cl_admin.lua:96

Unregisters a page. Its sidebar button is left in place.

Parameters

  • id String page ID

PANEL:set_fullscreen(fullscreen)

client plugins/admin/plugin/views/cl_admin.lua:138

Slides the sidebar out of view and shows a back button, or restores the normal layout.

Parameters

  • fullscreen Boolean

Defined in