kopia lustrzana https://github.com/wagtail/wagtail
Document register_page_listing_more_buttons (#3377)
* add docs for register_page_listing_more_buttonspull/3374/merge
rodzic
c239932434
commit
b00bf70229
|
|
@ -558,6 +558,30 @@ Page explorer
|
|||
The ``priority`` argument controls the order the buttons are displayed in. Buttons are ordered from low to high priority, so a button with ``priority=10`` will be displayed before a button with ``priority=20``.
|
||||
|
||||
|
||||
.. register_page_listing_more_buttons:
|
||||
|
||||
``register_page_listing_more_buttons``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Add buttons to the "More" dropdown menu for a page in the page explorer. This works similarly to the ``register_page_listing_buttons`` hook but is useful for lesser-used custom actions that are better suited for the dropdown.
|
||||
|
||||
This example will add a simple button to the dropdown menu:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailadmin import widgets as wagtailadmin_widgets
|
||||
|
||||
@hooks.register('register_page_listing_more_buttons')
|
||||
def page_listing_more_buttons(page, page_perms, is_parent=False):
|
||||
yield wagtailadmin_widgets.PageListingButton(
|
||||
'A dropdown button',
|
||||
'/goes/to/a/url/',
|
||||
priority=10
|
||||
)
|
||||
|
||||
The ``priority`` argument controls the order the buttons are displayed in the dropdown. Buttons are ordered from low to high priority, so a button with ``priority=10`` will be displayed before a button with ``priority=20``.
|
||||
|
||||
|
||||
Buttons with dropdown lists
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue