Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web Form Context unset banner_image and not use webform_banner_image from custom context #26173

Open
igaitan opened this issue Apr 26, 2024 · 0 comments
Labels

Comments

@igaitan
Copy link

igaitan commented Apr 26, 2024

Description of the issue

When a Web Form docType is rendered, the context for the default template is unsetting "banner_image" so default nav bar is not rendering the brand image.
Also sets the "webform_banner_image" to self.banner_image AFTER loading custom context from the custom app, so at the end is not possible to override the custom context configured values for the web form.

Context information (for bug reports)

Output of bench version

frappe 15.23.0

Tested on
Version frappe 15.23.0
Version frappe 15.24.1

Steps to reproduce the issue

  1. Set a banner_image on the Website Settings configuration for the navbar
  2. Create a Web Form without banner_image, with is_standard as True web form context py file is generated
  3. Add to the context py file of the web form a line to add a form_banner_image image.

Observed result

  • When you access the Web Form, you will not see the brand / nav bar image
  • You will not see the image set on the custom context py file for the form_banner_image variable, in case you set banner image on the Web Form you will always see that one instead of the used in the custom context py file.

Expected result

  • Nav bar always renders the defined banner / brand image.
  • On a Web form the custom context values defined in the py file should override any default one.

Additional information

The issue is on frappe/website/doctype/web_form/web_form.py file at line 248 and 259

self.add_custom_context_and_script(context)
self.load_translations(context)
self.add_metatags(context)
context.boot = get_boot_data()
context.boot["link_title_doctypes"] = frappe.boot.get_link_title_doctypes()
context.webform_banner_image = self.banner_image
context.pop("banner_image", None)

self.add_custom_context_and_script() is called BEFORE context.webform_banner_image = self.banner_image so any custom value for that variable will be override.

Also the last line context.pop("banner_image", None) will unset brand / navbar banner_image as the context key is exactly that.

@igaitan igaitan added the bug label Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant