sections_fts: 28
This data as json
rowid | title | content |
---|---|---|
28 | menu_links(datasette, actor, request) | datasette - Datasette class You can use this to access plugin configuration options via datasette.plugin_config(your_plugin_name) , or to execute SQL queries. actor - dictionary or None The currently authenticated actor . request - Request object or None The current HTTP request. This can be None if the request object is not available. This hook allows additional items to be included in the menu displayed by Datasette's top right menu icon. The hook should return a list of {"href": "...", "label": "..."} menu items. These will be added to the menu. It can alternatively return an async def awaitable function which returns a list of menu items. This example adds a new menu item but only if the signed in user is "root" : from datasette import hookimpl @hookimpl def menu_links(datasette, actor): if actor and actor.get("id") == "root": return [ { "href": datasette.urls.path( "/-/edit-schema" ), "label": "Edit schema", }, ] Using datasette.urls here ensures that links in the menu will take the base_url setting into account. Examples: datasette-search-all , datasette-graphql |