Refactor translationwizard forms#7
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR centralizes form markup into helper functions (tw_form_open and tw_form_close) and refactors existing pages to use these helpers.
- Introduce
form_helpers.phpwithtw_form_openandtw_form_close - Update
default.phpto replace raw<form>markup with helper calls - Update
check.phpto replace raw<form>markup with helper calls - Require the new helper in the main module file
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| systems/translationwizard/translationwizard/form_helpers.php | Add helper functions for opening and closing forms |
| systems/translationwizard/translationwizard/default.php | Replace inline form and hidden inputs with helper calls |
| systems/translationwizard/translationwizard/check.php | Replace inline form and hidden inputs with helper calls |
| systems/translationwizard/translationwizard.php | Add require_once for the new helper file |
Comments suppressed due to low confidence (2)
systems/translationwizard/translationwizard.php:8
- The require_once path is incorrect: form_helpers.php is located alongside translationwizard.php in the same directory. Update to use a relative path, for example: require_once DIR . '/form_helpers.php';
require_once("modules/translationwizard/form_helpers.php");
systems/translationwizard/translationwizard/check.php:83
- Including 'op' => 'check' as a hidden field duplicates the action's GET parameter and may override the mode. Consider removing the redundant hidden 'op' or move 'mode' into the hidden array instead of embedding it in the action string.
tw_form_open('check&mode=delete', ['op' => 'check']);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
php -l systems/translationwizard/translationwizard/form_helpers.phpphp -l systems/translationwizard/translationwizard/check.phpphp -l systems/translationwizard/translationwizard/default.phpphp -l systems/translationwizard/translationwizard.phphttps://chatgpt.com/codex/tasks/task_e_6873c1abebfc8329ab3a41e0bcaa118e