Trying to understand Wagtail CMS internals: where is the template variable allow_external_link defined?

I have difficulties in understanding how the modal dialog that allows to insert different Link types into a richtext field functions. Specifically in this file:

https://github.com/wagtail/wagtail/blob/main/wagtail/admin/templates/wagtailadmin/chooser/_link_types.html

The allow_xyz parameters: where are they set?

E.g.: {% elif allow_external_link %} Where/when is allow_external_link defined or set to True?

Thanks in advance

Each of the views in wagtail.admin.views.chooser calls the shared_context function, which picks up these flags from the URL and makes them available to the template:

https://github.com/wagtail/wagtail/blob/97975b529373b30081520995b354ae19738135f1/wagtail/admin/views/chooser.py#L36-L39

These URL variables are passed on as part of any links that move from one stage of the modal to another.

Вернуться на верх