Browse Source

Add docs for FieldPanel's icon parameter

Sage Abdullah 2 years ago
parent
commit
eb49f3cdf0
2 changed files with 7 additions and 2 deletions
  1. 1 0
      docs/advanced_topics/icons.md
  2. 6 2
      docs/reference/pages/panels.md

+ 1 - 0
docs/advanced_topics/icons.md

@@ -75,6 +75,7 @@ Place your app before any Wagtail apps in `INSTALLED_APPS`.
 Wagtail icons live in `wagtail/admin/templates/wagtailadmin/icons/`.
 Place your own SVG files in `<your_app>/templates/wagtailadmin/icons/`.
 
+(available_icons)=
 ## Available icons
 
 Enable the [styleguide](styleguide) to view the available icons and their names for any given project.

+ 6 - 2
docs/reference/pages/panels.md

@@ -19,7 +19,7 @@ Here are some Wagtail-specific types that you might include as fields in your mo
 ### FieldPanel
 
 ```{eval-rst}
-.. class:: FieldPanel(field_name, classname=None, widget=None, heading='', disable_comments=False, permission=None)
+.. class:: FieldPanel(field_name, classname=None, widget=None, icon=None, heading='', disable_comments=False, permission=None)
 
     This is the panel used for basic Django field types.
 
@@ -27,7 +27,7 @@ Here are some Wagtail-specific types that you might include as fields in your mo
 
         This is the name of the class property used in your model definition.
 
-    .. attribute:: FieldPanel.classname
+    .. attribute:: FieldPanel.classname (optional)
 
         This is a string of optional CSS classes given to the panel which are used in formatting and scripted interactivity.
 
@@ -37,6 +37,10 @@ Here are some Wagtail-specific types that you might include as fields in your mo
 
         This parameter allows you to specify a :doc:`Django form widget <django:ref/forms/widgets>` to use instead of the default widget for this field type.
 
+    .. attribute:: FieldPanel.icon (optional)
+
+        This allows you to override the icon for the panel. If unset, Wagtail uses a set of default icons for common model field types. For a list of icons available out of the box, see :ref:`available_icons`. Project-specific icons are also displayed in the :ref:`styleguide`.
+
     .. attribute:: FieldPanel.heading (optional)
 
         This allows you to override the heading for the panel, which will otherwise be set automatically using the form field's label (taken in turn from a model field's ``verbose_name``).