diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index f2ae12b09c14..bf4d9d1252ba 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -95,6 +95,7 @@ Changelog
* Maintenance: Update uuid to v9 and Jest to v29, with `jest-environment-jsdom` and new snapshot format (LB (Ben) Johnston)
* Maintenance: Update test cases producing undesirable console output due to missing mocks, uncaught errors, warnings (LB (Ben) Johnston)
* Maintenance: Remove unused snippets _header_with_history.html template (Thibaud Colas)
+ * Maintenance: Remove `"wagtailadmin/shared/field_as_li.html"` template include (Storm Heg)
5.0.2 (21.06.2023)
diff --git a/docs/releases/5.1.md b/docs/releases/5.1.md
index 834fe309c697..17e12f37f55b 100644
--- a/docs/releases/5.1.md
+++ b/docs/releases/5.1.md
@@ -151,6 +151,7 @@ This feature was developed by Aman Pandey as part of the Google Summer of Code p
* Remove unused snippets _header_with_history.html template (Thibaud Colas)
* Migrate dialog instantiation to a new `w-dialog` Stimulus controller, including in the Userbar (Loveth Omokaro, LB (Ben) Johnston)
* Support dialog template cloning using a new `w-teleport` Stimulus controller (Loveth Omokaro, LB (Ben) Johnston)
+ * Remove `"wagtailadmin/shared/field_as_li.html"` template include (Storm Heg)
## Upgrade considerations
@@ -300,6 +301,24 @@ The undocumented shared include `wagtailadmin/shared/last_updated.html` is no lo
{% human_readable_date my_model.timestamp %}
```
+### Shared include `field_as_li.html` is no longer available
+
+The documented include `"wagtailadmin/shared/field_as_li.html"` has been removed, if being used it will need to be replaced with `"wagtailadmin/shared/field.html"` wrapped within `li` tags.
+
+#### Before
+
+```html+django
+{% include "wagtailadmin/shared/field_as_li.html" %}
+```
+
+#### After
+
+```html+django
+
+ {% include "wagtailadmin/shared/field.html" %}
+
+```
+
### Tag (Tagit) field usage now relies on data attributes
The `AdminTagWidget` widget has now been migrated to a Stimulus controller, if using this widget in Python, no changes are needed to adopt the new approach.
diff --git a/wagtail/admin/templates/wagtailadmin/chooser/anchor_link.html b/wagtail/admin/templates/wagtailadmin/chooser/anchor_link.html
index c3be2c7f3046..8140cb198d5a 100644
--- a/wagtail/admin/templates/wagtailadmin/chooser/anchor_link.html
+++ b/wagtail/admin/templates/wagtailadmin/chooser/anchor_link.html
@@ -9,7 +9,9 @@
{% csrf_token %}
diff --git a/wagtail/admin/templates/wagtailadmin/chooser/email_link.html b/wagtail/admin/templates/wagtailadmin/chooser/email_link.html
index 1938f3da9a7c..eaaedd7df136 100644
--- a/wagtail/admin/templates/wagtailadmin/chooser/email_link.html
+++ b/wagtail/admin/templates/wagtailadmin/chooser/email_link.html
@@ -9,7 +9,9 @@
{% csrf_token %}
diff --git a/wagtail/admin/templates/wagtailadmin/chooser/external_link.html b/wagtail/admin/templates/wagtailadmin/chooser/external_link.html
index a00e0d39b18e..5c57f467e8a5 100644
--- a/wagtail/admin/templates/wagtailadmin/chooser/external_link.html
+++ b/wagtail/admin/templates/wagtailadmin/chooser/external_link.html
@@ -9,7 +9,9 @@
{% csrf_token %}
diff --git a/wagtail/admin/templates/wagtailadmin/chooser/phone_link.html b/wagtail/admin/templates/wagtailadmin/chooser/phone_link.html
index 1db1e3cdd81b..9c8b56ca5743 100644
--- a/wagtail/admin/templates/wagtailadmin/chooser/phone_link.html
+++ b/wagtail/admin/templates/wagtailadmin/chooser/phone_link.html
@@ -9,7 +9,9 @@
{% csrf_token %}
diff --git a/wagtail/admin/templates/wagtailadmin/generic/chooser/chooser.html b/wagtail/admin/templates/wagtailadmin/generic/chooser/chooser.html
index 7b9b42dceb88..511c1085ee69 100644
--- a/wagtail/admin/templates/wagtailadmin/generic/chooser/chooser.html
+++ b/wagtail/admin/templates/wagtailadmin/generic/chooser/chooser.html
@@ -36,7 +36,9 @@
{% if filter_form.visible_fields %}
{% for field in filter_form.visible_fields %}
- {% include "wagtailadmin/shared/field_as_li.html" with field=field %}
+
+ {% include "wagtailadmin/shared/field.html" with field=field %}
+
{% endfor %}
{% endif %}
diff --git a/wagtail/admin/templates/wagtailadmin/generic/chooser/creation_form.html b/wagtail/admin/templates/wagtailadmin/generic/chooser/creation_form.html
index 2ac4e25fc62b..61137f1b6c83 100644
--- a/wagtail/admin/templates/wagtailadmin/generic/chooser/creation_form.html
+++ b/wagtail/admin/templates/wagtailadmin/generic/chooser/creation_form.html
@@ -13,7 +13,9 @@
{% for field in creation_form.visible_fields %}
- {% include "wagtailadmin/shared/field_as_li.html" with field=field %}
+
+ {% include "wagtailadmin/shared/field.html" with field=field %}
+
{% endfor %}
{% if create_action_clicked_label %}
diff --git a/wagtail/admin/templates/wagtailadmin/generic/form.html b/wagtail/admin/templates/wagtailadmin/generic/form.html
index 229037105135..f998c4820604 100644
--- a/wagtail/admin/templates/wagtailadmin/generic/form.html
+++ b/wagtail/admin/templates/wagtailadmin/generic/form.html
@@ -19,7 +19,9 @@
{% block visible_fields %}
{% for field in form.visible_fields %}
- {% include "wagtailadmin/shared/field_as_li.html" %}
+
+ {% include "wagtailadmin/shared/field.html" %}
+
{% endfor %}
{% endblock %}
diff --git a/wagtail/admin/templates/wagtailadmin/generic/multiple_upload/edit_form.html b/wagtail/admin/templates/wagtailadmin/generic/multiple_upload/edit_form.html
index 84f049dae3d8..b1e14d5a018f 100644
--- a/wagtail/admin/templates/wagtailadmin/generic/multiple_upload/edit_form.html
+++ b/wagtail/admin/templates/wagtailadmin/generic/multiple_upload/edit_form.html
@@ -9,7 +9,9 @@
{% if field.is_hidden %}
{{ field }}
{% else %}
- {% include "wagtailadmin/shared/field_as_li.html" %}
+
+ {% include "wagtailadmin/shared/field.html" %}
+
{% endif %}
{% endfor %}
diff --git a/wagtail/admin/templates/wagtailadmin/pages/copy.html b/wagtail/admin/templates/wagtailadmin/pages/copy.html
index 953f889f1e4c..51e04687a708 100644
--- a/wagtail/admin/templates/wagtailadmin/pages/copy.html
+++ b/wagtail/admin/templates/wagtailadmin/pages/copy.html
@@ -11,20 +11,32 @@
- {% include "wagtailadmin/shared/field_as_li.html" with field=form.new_title %}
- {% include "wagtailadmin/shared/field_as_li.html" with field=form.new_slug %}
- {% include "wagtailadmin/shared/field_as_li.html" with field=form.new_parent_page %}
+
+ {% include "wagtailadmin/shared/field.html" with field=form.new_title %}
+
+
+ {% include "wagtailadmin/shared/field.html" with field=form.new_slug %}
+
+
+ {% include "wagtailadmin/shared/field.html" with field=form.new_parent_page %}
+
{% if form.copy_subpages %}
- {% include "wagtailadmin/shared/field_as_li.html" with field=form.copy_subpages %}
+
+ {% include "wagtailadmin/shared/field.html" with field=form.copy_subpages %}
+
{% endif %}
{% if form.publish_copies %}
- {% include "wagtailadmin/shared/field_as_li.html" with field=form.publish_copies %}
+
+ {% include "wagtailadmin/shared/field.html" with field=form.publish_copies %}
+
{% endif %}
{% if form.alias %}
- {% include "wagtailadmin/shared/field_as_li.html" with field=form.alias %}
+
+ {% include "wagtailadmin/shared/field.html" with field=form.alias %}
+
{% endif %}
diff --git a/wagtail/admin/templates/wagtailadmin/pages/move_choose_destination.html b/wagtail/admin/templates/wagtailadmin/pages/move_choose_destination.html
index 0cc262bb3e2a..134dc8ac7501 100644
--- a/wagtail/admin/templates/wagtailadmin/pages/move_choose_destination.html
+++ b/wagtail/admin/templates/wagtailadmin/pages/move_choose_destination.html
@@ -10,7 +10,9 @@
{% csrf_token %}
- {% include "wagtailadmin/shared/field_as_li.html" with field=move_form.new_parent_page %}
+
+ {% include "wagtailadmin/shared/field.html" with field=move_form.new_parent_page %}
+
diff --git a/wagtail/admin/templates/wagtailadmin/shared/field_as_li.html b/wagtail/admin/templates/wagtailadmin/shared/field_as_li.html
deleted file mode 100644
index 7789d7c340a0..000000000000
--- a/wagtail/admin/templates/wagtailadmin/shared/field_as_li.html
+++ /dev/null
@@ -1 +0,0 @@
- {% include "wagtailadmin/shared/field.html" %}
diff --git a/wagtail/admin/templates/wagtailadmin/workflows/create_task.html b/wagtail/admin/templates/wagtailadmin/workflows/create_task.html
index f5516daacbc3..e450380b0a62 100644
--- a/wagtail/admin/templates/wagtailadmin/workflows/create_task.html
+++ b/wagtail/admin/templates/wagtailadmin/workflows/create_task.html
@@ -18,7 +18,9 @@
{% for field in form %}
{% if not field.is_hidden %}
- {% include "wagtailadmin/shared/field_as_li.html" %}
+
+ {% include "wagtailadmin/shared/field.html" %}
+
{% else %}
{{ field }}
{% endif %}
diff --git a/wagtail/admin/templates/wagtailadmin/workflows/edit_task.html b/wagtail/admin/templates/wagtailadmin/workflows/edit_task.html
index 472525b281ca..7b5624d35e19 100644
--- a/wagtail/admin/templates/wagtailadmin/workflows/edit_task.html
+++ b/wagtail/admin/templates/wagtailadmin/workflows/edit_task.html
@@ -17,7 +17,9 @@
{% for field in form %}
{% if not field.is_hidden %}
- {% include "wagtailadmin/shared/field_as_li.html" %}
+
+ {% include "wagtailadmin/shared/field.html" %}
+
{% else %}
{{ field }}
{% endif %}
diff --git a/wagtail/admin/templates/wagtailadmin/workflows/task_chooser/chooser.html b/wagtail/admin/templates/wagtailadmin/workflows/task_chooser/chooser.html
index eeecc0925501..0b987262f13c 100644
--- a/wagtail/admin/templates/wagtailadmin/workflows/task_chooser/chooser.html
+++ b/wagtail/admin/templates/wagtailadmin/workflows/task_chooser/chooser.html
@@ -33,7 +33,9 @@
@@ -48,7 +50,9 @@
diff --git a/wagtail/admin/templates/wagtailadmin/workflows/task_chooser/includes/create_form.html b/wagtail/admin/templates/wagtailadmin/workflows/task_chooser/includes/create_form.html
index 3dedd957df93..5d5e99efcbdc 100644
--- a/wagtail/admin/templates/wagtailadmin/workflows/task_chooser/includes/create_form.html
+++ b/wagtail/admin/templates/wagtailadmin/workflows/task_chooser/includes/create_form.html
@@ -15,7 +15,9 @@
{% if field.is_hidden %}
{{ field }}
{% else %}
- {% include "wagtailadmin/shared/field_as_li.html" with field=field %}
+
+ {% include "wagtailadmin/shared/field.html" with field=field %}
+
{% endif %}
{% endfor %}
diff --git a/wagtail/contrib/forms/templates/wagtailforms/submissions_index.html b/wagtail/contrib/forms/templates/wagtailforms/submissions_index.html
index 666a5efaf68d..663e56f67c6f 100644
--- a/wagtail/contrib/forms/templates/wagtailforms/submissions_index.html
+++ b/wagtail/contrib/forms/templates/wagtailforms/submissions_index.html
@@ -110,7 +110,9 @@ {% trans 'Filter' %}
{% icon name="spinner" %}{% trans 'Apply filters' %}
{% for field in select_date_form %}
- {% include "wagtailadmin/shared/field_as_li.html" with field=field %}
+
+ {% include "wagtailadmin/shared/field.html" with field=field %}
+
{% endfor %}
diff --git a/wagtail/contrib/redirects/templates/wagtailredirects/add.html b/wagtail/contrib/redirects/templates/wagtailredirects/add.html
index e18175509c40..6d2e7f52c924 100644
--- a/wagtail/contrib/redirects/templates/wagtailredirects/add.html
+++ b/wagtail/contrib/redirects/templates/wagtailredirects/add.html
@@ -12,7 +12,9 @@
{% for field in form.visible_fields %}
- {% include "wagtailadmin/shared/field_as_li.html" %}
+
+ {% include "wagtailadmin/shared/field.html" %}
+
{% endfor %}
diff --git a/wagtail/contrib/redirects/templates/wagtailredirects/choose_import_file.html b/wagtail/contrib/redirects/templates/wagtailredirects/choose_import_file.html
index 5f7bd0694269..901ef7f90ae3 100644
--- a/wagtail/contrib/redirects/templates/wagtailredirects/choose_import_file.html
+++ b/wagtail/contrib/redirects/templates/wagtailredirects/choose_import_file.html
@@ -23,7 +23,9 @@
{% for field in form.visible_fields %}
- {% include "wagtailadmin/shared/field_as_li.html" %}
+
+ {% include "wagtailadmin/shared/field.html" %}
+
{% endfor %}
diff --git a/wagtail/contrib/redirects/templates/wagtailredirects/confirm_import.html b/wagtail/contrib/redirects/templates/wagtailredirects/confirm_import.html
index 39088be6992b..dd227a7c5f79 100644
--- a/wagtail/contrib/redirects/templates/wagtailredirects/confirm_import.html
+++ b/wagtail/contrib/redirects/templates/wagtailredirects/confirm_import.html
@@ -16,7 +16,9 @@
{% for field in form.visible_fields %}
- {% include "wagtailadmin/shared/field_as_li.html" %}
+
+ {% include "wagtailadmin/shared/field.html" %}
+
{% endfor %}
diff --git a/wagtail/contrib/redirects/templates/wagtailredirects/edit.html b/wagtail/contrib/redirects/templates/wagtailredirects/edit.html
index c9c81cb03487..535b4c371c58 100644
--- a/wagtail/contrib/redirects/templates/wagtailredirects/edit.html
+++ b/wagtail/contrib/redirects/templates/wagtailredirects/edit.html
@@ -12,7 +12,9 @@
{% for field in form.visible_fields %}
- {% include "wagtailadmin/shared/field_as_li.html" %}
+
+ {% include "wagtailadmin/shared/field.html" %}
+
{% endfor %}
diff --git a/wagtail/contrib/simple_translation/templates/simple_translation/admin/submit_translation.html b/wagtail/contrib/simple_translation/templates/simple_translation/admin/submit_translation.html
index 91fb696e3d19..895e1cbf03fd 100644
--- a/wagtail/contrib/simple_translation/templates/simple_translation/admin/submit_translation.html
+++ b/wagtail/contrib/simple_translation/templates/simple_translation/admin/submit_translation.html
@@ -18,7 +18,9 @@
{% block visible_fields %}
{% for field in form.visible_fields %}
- {% include "wagtailadmin/shared/field_as_li.html" %}
+
+ {% include "wagtailadmin/shared/field.html" %}
+
{% endfor %}
{% endblock %}
{% if form.show_submit %}
diff --git a/wagtail/contrib/styleguide/templates/wagtailstyleguide/base.html b/wagtail/contrib/styleguide/templates/wagtailstyleguide/base.html
index d4eafd7ec4d1..204a594f8aa0 100644
--- a/wagtail/contrib/styleguide/templates/wagtailstyleguide/base.html
+++ b/wagtail/contrib/styleguide/templates/wagtailstyleguide/base.html
@@ -472,7 +472,9 @@ Mixtures
{% if field.name == 'file' %}
{% include "wagtailimages/images/_file_field.html" %}
{% else %}
- {% include "wagtailadmin/shared/field_as_li.html" %}
+
+ {% include "wagtailadmin/shared/field.html" %}
+
{% endif %}
{% endfor %}
{% trans 'Save' %} {% trans "Delete image" %}
diff --git a/wagtail/documents/templates/wagtaildocs/documents/add.html b/wagtail/documents/templates/wagtaildocs/documents/add.html
index afd985cb272a..c9dcdcd3e80f 100644
--- a/wagtail/documents/templates/wagtaildocs/documents/add.html
+++ b/wagtail/documents/templates/wagtaildocs/documents/add.html
@@ -57,7 +57,9 @@
{% if field.is_hidden %}
{{ field }}
{% else %}
- {% include "wagtailadmin/shared/field_as_li.html" with field=field %}
+
+ {% include "wagtailadmin/shared/field.html" with field=field %}
+
{% endif %}
{% endfor %}
diff --git a/wagtail/documents/templates/wagtaildocs/documents/edit.html b/wagtail/documents/templates/wagtaildocs/documents/edit.html
index ca8035697337..ac9bb0196e47 100644
--- a/wagtail/documents/templates/wagtaildocs/documents/edit.html
+++ b/wagtail/documents/templates/wagtaildocs/documents/edit.html
@@ -32,7 +32,9 @@
{% elif field.is_hidden %}
{{ field }}
{% else %}
- {% include "wagtailadmin/shared/field_as_li.html" %}
+
+ {% include "wagtailadmin/shared/field.html" %}
+
{% endif %}
{% endfor %}
diff --git a/wagtail/embeds/templates/wagtailembeds/chooser/chooser.html b/wagtail/embeds/templates/wagtailembeds/chooser/chooser.html
index 9a2082eddbf4..4a05635c655e 100644
--- a/wagtail/embeds/templates/wagtailembeds/chooser/chooser.html
+++ b/wagtail/embeds/templates/wagtailembeds/chooser/chooser.html
@@ -9,7 +9,9 @@
{% csrf_token %}
{% for field in form %}
- {% include "wagtailadmin/shared/field_as_li.html" with field=field %}
+
+ {% include "wagtailadmin/shared/field.html" with field=field %}
+
{% endfor %}