Skip to content
This repository has been archived by the owner on Dec 6, 2021. It is now read-only.

docs: Docs for Custom Webform Context hook #173

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions frappe_docs/www/docs/user/en/python-api/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,23 @@ The above configuration will render `/not_found` when a 404 is occurred. It is
upto you to implement the template `www/not_found.html` and controller
`www/not_found.py`.

## Custom Web Form Context
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Custom Web Form Context
## Web Form Context


When a Web Form is created using non custom doctype, we can get the context from doctype's module but for Web Form using custom doctype you cannot get the context since custom doctype don't have modules, you can use this hook to create a context for Custom Web Form.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When a Web Form is created using non custom doctype, we can get the context from doctype's module but for Web Form using custom doctype you cannot get the context since custom doctype don't have modules, you can use this hook to create a context for Custom Web Form.
When a Web Form is created for a standard doctype, we can get the context from doctype's module. Although for a Web Form for a custom doctype you cannot get the context since custom doctype don't have modules, you can use this hook to create a context for Custom Web Form.

I tried re-wording this.

The sentence is too complex...Maybe break it down into 2-3 simpler sentences.

Use standard instead of "non custom", if it fits.

Also, wording for "doctype's module" is ambiguous. Even I'm not sure what you're talking about 😅


**app/hooks.py**
```py
webform_list_context = "app.webform.get_webform_list_context"
```

**app/webform.py**
```py
def get_webform_list_context():
return {
"get_list": get_webform_transaction_list
}
```

## Default Homepage

Homepage is the page which is rendered when you visit the root URL (`/`) of your
Expand Down