Преглед изворни кода

Fix incorrect function signature on `register_snippet_action_menu_item` hook docs (#11621)

Added "model" argument to register_guacamole_menu_item of documentation
arshyia3000 пре 1 година
родитељ
комит
e97f3648c7
2 измењених фајлова са 3 додато и 2 уклоњено
  1. 1 0
      CONTRIBUTORS.md
  2. 2 2
      docs/reference/hooks.md

+ 1 - 0
CONTRIBUTORS.md

@@ -797,6 +797,7 @@
 * Ankur Raiyani
 * Hossein
 * Andre Delorme
+* arshyia3000
 
 ## Translators
 

+ 2 - 2
docs/reference/hooks.md

@@ -1214,7 +1214,7 @@ def before_snippet_delete(request, instances):
 ### `register_snippet_action_menu_item`
 
 Add an item to the popup menu of actions on the snippet creation and edit views.
-The callable passed to this hook must return an instance of `wagtail.snippets.action_menu.ActionMenuItem`. `ActionMenuItem` is a subclass of [Component](creating_template_components) and so the rendering of the menu item can be customised through `template_name`, `get_context_data`, `render_html` and `Media`. In addition, the following attributes and methods are available to be overridden:
+The callable passed to this hook receives the snippet's model class as an argument, and must return an instance of `wagtail.snippets.action_menu.ActionMenuItem`. `ActionMenuItem` is a subclass of [Component](creating_template_components) and so the rendering of the menu item can be customised through `template_name`, `get_context_data`, `render_html` and `Media`. In addition, the following attributes and methods are available to be overridden:
 
 -   `order` - an integer (default 100) which determines the item's position in the menu. Can also be passed as a keyword argument to the object constructor. The lowest-numbered item in this sequence will be selected as the default menu item; as standard, this is "Save draft" (which has an `order` of 0).
 -   `label` - the displayed text of the menu item
@@ -1244,7 +1244,7 @@ class GuacamoleMenuItem(ActionMenuItem):
 
 
 @hooks.register('register_snippet_action_menu_item')
-def register_guacamole_menu_item():
+def register_guacamole_menu_item(model):
     return GuacamoleMenuItem(order=10)
 ```