Decouple the localised script data from PDF_TEMPLATE_LOCATION - #1701
Open
jakejackson1 wants to merge 1 commit into
Open
Decouple the localised script data from PDF_TEMPLATE_LOCATION#1701jakejackson1 wants to merge 1 commit into
jakejackson1 wants to merge 1 commit into
Conversation
`Helper_Data::get_localised_script_data()` sourced `pdfWorkingDir` from the v3 `PDF_TEMPLATE_LOCATION` constant, which is defined inside `src/deprecated.php`. That made a file slated for deletion in 7.0 load-bearing for the React Template Manager: `pdfWorkingDir` is what `TemplateFooterActions::notCoreTemplate()` compares each template path against to decide whether the delete button renders. The constant is defined as `Helper_Templates::get_template_path()`, so pass that helper in and call it directly. Value is identical on both single and multisite; as a bonus it is no longer frozen at `after_setup_theme`. Phase 1 of the 7.0 deprecated code removal plan. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Phase 1 of the 7.0 deprecated code removal plan — non-breaking, ships in 6.17.
Helper_Data::get_localised_script_data()sourcedpdfWorkingDirfrom the v3PDF_TEMPLATE_LOCATIONconstant, which is defined insidesrc/deprecated.php. That made a file slated for deletion in 7.0 load-bearing for the React Template Manager:pdfWorkingDiris whatTemplateFooterActions::notCoreTemplate()compares each template path against to decide whether the delete button renders.The constant is defined as
Helper_Templates::get_template_path(), so the helper is now passed intoget_localised_script_data()and called directly. The value is byte-identical on both single and multisite, and is no longer frozen atafter_setup_theme.GFPDF_Core::setup_constants()still defines all four v3 constants for third parties — those go in Phase 2 alongside the rest ofsrc/deprecated.php.Notes
get_localised_script_data()gains a third required parameter. The only caller isRouter::load_admin_assets(); add-ons extend this data through the documentedgfpdf_localised_script_arrayfilter, not by calling the method.PDF_TEMPLATE_LOCATIONnow has no remaining consumer insrc/.Testing
Test_Helper_Data::test_localised_scriptnow assertspdfWorkingDirresolves to the working directory (multisite-aware) rather than only checking the key exists.Test_Helper_Datagreen.TemplateFooterActionsJest suite green — the JS contract is unchanged.🤖 Generated with Claude Code