Skip to content

Report hook-only deprecations generically and run the Tools tab hooks on the General tab - #2009

Merged
jakejackson1 merged 1 commit into
developmentfrom
refactor/hook-only-deprecations
Nov 10, 2026
Merged

jakejackson1 merged 1 commit into
developmentfrom
refactor/hook-only-deprecations

Conversation

@gravitypdf-bot

@gravitypdf-bot gravitypdf-bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-ups from the /simplify passes on #1996 and #1997. A removal that leaves nothing behind but its hooks is now a single get_features() entry: when a feature declares hooks and no detect, Deprecation finds the third-party listeners itself and the System Report shows their counts. The Tools tab and v3 hook features both use that path now, and get_active_deprecated_filters(), which that replaces, is deprecated rather than deleted. The Tools tab hooks keep running at the bottom of the General tab until 7.0.

  • Deprecation::get_signals() falls back to get_hooks_with_listeners( hooks, hook_prefix, internal_callbacks ) for a hook-only feature.
  • New Deprecation::is_hook_only() holds the "hooks and no detect" rule. The engine and View_System_Report both call it.
  • View_System_Report uses get_deprecated_filter_feature() for a hook-only feature. deprecated_filters and tools_tab_hooks leave get_deprecated_feature_descriptions().
  • New Deprecation_Hooks provider: holds tools_tab_hooks, and is where any later hook-only removal goes.
  • Deprecation_Tools_Tab is deleted. Deprecation_Hooks replaces it, and the class has never been in a release, so nothing can be calling it.
  • gfpdf_settings_tools fields render under a Tools heading, in their own form below the General form, then gfpdf_post_tools_settings_page fires at the bottom of the page. Both need the gravityforms_edit_settings capability, as the Tools tab did.
  • New Deprecation::do_action() fires the action through the same path as Deprecation::apply_filters(), so both hooks read their versions and replacements from the registration and log a third-party listener. The shared messages now say "hook" rather than "filter".
  • tools_tab_hooks moves to the deprecated group, removed in 7.0, and its notice says where the settings went.
  • Deprecation_V3's deprecated_filters drops its detect and uses the generic path. With no caller left, get_active_deprecated_filters() is deprecated in favour of Deprecation::get_signals(). It still works.

Try it

  1. Add this to a mu-plugin: add_filter( 'gfpdf_settings_tools', function ( $s ) { $s['my_tool'] = [ 'id' => 'my_tool', 'name' => 'My Tool', 'type' => 'button', 'std' => 'Run' ]; return $s; } ); add_action( 'gfpdf_post_tools_settings_page', function () { echo 'Tools action'; } ); add_filter( 'gfpdf_rtl', '__return_true' );
  2. Open Forms > Settings > PDF. "My Tool" shows under a Tools heading below the Save Settings button, in its own form, with "Tools action" after it.
  3. Open Forms > System Status. "Actions and Filters" (gfpdf_rtl has 1 listener) is listed as unsupported and "Tools Tab Actions and Filters" (gfpdf_settings_tools has 1 listener) as deprecated.
  4. Open Tools > Site Health. The deprecated-features test names both.

Test plan

  • PHPUnit on the tip rebased onto development, for Test_Options_API, Test_Actions, Test_Deprecation*, Test_View_Actions, Test_View_System_Report, Test_Controller_Actions, Test_Public_Api*, Test_Upgrade_Routines, Test_Site_Health*, Test_Removed_Methods, Test_Settings, Test_Controller_System_Report, Test_Hook_Inventory, Test_View_GravityForm_Settings_Markup and Test_Form_Settings. Single site: 294 tests pass, 1 skipped. Multisite: 291 tests pass.
  • Dev site: the Tools tab field and action render after the General form, and each hook raises its deprecation notice
  • PHPCS and PHPStan clean on the new tip
  • CI is green
More info
  • get_active_deprecated_filters(). It still calls get_hooks_with_listeners() with the v3 hook map and prefix, so it uses the same lookup as the engine. Its three behaviour tests now read Deprecation::get_signals()['deprecated_filters'], and a fourth asserts that the method is deprecated but still works.
  • is_hook_only(). A feature with hooks and its own detector keeps its own description. A registration with neither hooks nor detect fails visibly rather than silently reporting nothing.
  • Why a separate form. The Tools tab's form posted back to its own page and its fields were left out of settings sanitising, so a third-party button handles its own POST. Inside the General form it would post to options.php instead.
  • Where the filter fires. gfpdf_settings_tools runs from View_Settings::general(), not get_registered_fields(), which also runs on every REST request. The tools key therefore stays out of the registered fields, as it is on development.
  • Site Health Info. A declared group gets a panel, so every site now has a Deprecated panel reading "None detected", as the Unsupported panel already does.
  • Fixtures. Test_Deprecation::test_a_hook_only_feature_reports_its_listeners covers the generic path through Fake_Internal_Listener_Features. That fixture lost its detect and gained a hook_prefix.

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report for commit: b571ce2
File: ./tmp/jest-coverage/clover.xml

Cover ┌─────────────────────────┐ Freq.
   0% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  10% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  20% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  30% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  40% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  50% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  60% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  70% │ █░░░░░░░░░░░░░░░░░░░░░░ │  3.1%
  80% │ ██░░░░░░░░░░░░░░░░░░░░░ │  4.7%
  90% │ ██████░░░░░░░░░░░░░░░░░ │ 18.8%
 100% │ ███████████████████████ │ 73.4%
      └─────────────────────────┘
 *Legend:* █ = Current Distribution 
Summary - Lines: 93.99% | Methods: 90.96% | Branches: 85.66%
FilesLinesMethodsBranches
src/assets/js/react/actions
   fontManager.js97.92%91.67%100.00%
   templates.js100.00%100.00%100.00%
src/assets/js/react/components/Alert
   Alert.js100.00%100.00%100.00%
src/assets/js/react/components
   CustomHashRouter.js100.00%100.00%100.00%
   Empty.js100.00%100.00%100.00%
   ShowMessage.js80.65%80.00%72.22%
   Spinner.js100.00%100.00%100.00%
src/assets/js/react/components/FontManager
   AddFont.js100.00%100.00%100.00%
   AddUpdateFontFooter.js100.00%100.00%91.67%
   AdvancedButton.js100.00%100.00%100.00%
   DeleteConfirm.js90.91%75.00%100.00%
   FontDeleteButton.js100.00%80.00%100.00%
   FontDetail.js100.00%100.00%100.00%
   FontInstallButton.js100.00%66.67%100.00%
   FontList.js100.00%50.00%65.22%
   FontListAlertMessage.js100.00%100.00%100.00%
   FontListItems.js96.00%83.33%88.24%
   FontListSkeleton.js100.00%100.00%100.00%
   FontManager.js73.68%50.00%50.00%
   FontManagerBody.js89.12%90.32%84.96%
   FontManagerHeader.js100.00%100.00%25.00%
   FontPreview.js100.00%100.00%100.00%
   FontStatus.js100.00%66.67%100.00%
   FontUsage.js100.00%66.67%100.00%
   FontVariant.js94.12%80.00%90.24%
   FontVariantLabel.js100.00%100.00%100.00%
   Icon.js100.00%100.00%100.00%
   InitialAddUpdateState.js100.00%100.00%100.00%
   SearchBox.js90.00%66.67%69.23%
   TemplateTooltip.js100.00%100.00%100.00%
   UpdateFont.js75.00%50.00%64.29%
src/assets/js/react/components/Modal
   CloseDialog.js93.33%66.67%70.59%
src/assets/js/react/components/Template
   TemplateActivateButton.js100.00%100.00%100.00%
   TemplateButton.js85.71%66.67%100.00%
   TemplateContainer.js71.43%66.67%25.00%
   TemplateDeleteButton.js100.00%100.00%70.00%
   TemplateDocsLink.js100.00%100.00%100.00%
   TemplateFooterActions.js100.00%100.00%100.00%
   TemplateHeaderNavigation.js82.35%85.71%70.00%
   TemplateHeaderTitle.js100.00%100.00%100.00%
   TemplateList.js100.00%100.00%100.00%
   TemplateListItem.js100.00%100.00%92.86%
   TemplateListItemComponents.js100.00%100.00%100.00%
   TemplateManagerClosed.js100.00%100.00%100.00%
   TemplateScreenshot.js100.00%100.00%100.00%
   TemplateScreenshots.js100.00%100.00%50.00%
   TemplateSearch.js93.75%88.89%50.00%
   TemplateSingle.js100.00%100.00%100.00%
   TemplateSingleComponents.js100.00%100.00%75.00%
   TemplateUploader.js100.00%100.00%95.00%
   TemplateUploaderContext.js100.00%100.00%100.00%
   TemplateUploaderTile.js100.00%100.00%100.00%
src/assets/js/react/reducers
   fontManagerReducer.js91.46%100.00%81.08%
   index.js100.00%100.00%100.00%
   templateReducer.js100.00%100.00%100.00%
src/assets/js/react/sagas
   fontManager.js90.16%92.86%88.57%
   index.js100.00%100.00%100.00%
   templates.js91.30%100.00%100.00%
src/assets/js/react/selectors
   getTemplates.js91.11%100.00%83.33%
src/assets/js/react/utilities/FontManager
   associatedFontManagerSelectBox.js94.44%100.00%77.78%
   fontManagerReducer.js100.00%100.00%94.12%
   toggleUpdateFont.js100.00%100.00%100.00%
src/assets/js/react/utilities/Template
   hasPendingUpload.js100.00%100.00%100.00%
src/assets/js/react/utilities
   withRouterHooks.js100.00%100.00%100.00%

🤖 Jest coverage report

@gravitypdf-bot
gravitypdf-bot force-pushed the refactor/hook-only-deprecations branch from b75bcdb to 933d885 Compare November 5, 2026 03:45
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report for commit: b571ce2
File: tmp/coverage/report-xml/merged.xml

Cover ┌─────────────────────────┐ Freq.
   0% │ ██████░░░░░░░░░░░░░░░░░ │  7.1%
  10% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  20% │ █░░░░░░░░░░░░░░░░░░░░░░ │  0.4%
  30% │ █░░░░░░░░░░░░░░░░░░░░░░ │  0.9%
  40% │ █░░░░░░░░░░░░░░░░░░░░░░ │  0.4%
  50% │ ███████░░░░░░░░░░░░░░░░ │  9.3%
  60% │ █░░░░░░░░░░░░░░░░░░░░░░ │  1.3%
  70% │ ██░░░░░░░░░░░░░░░░░░░░░ │  2.7%
  80% │ ████████████░░░░░░░░░░░ │ 16.4%
  90% │ ███████████████████████ │ 31.6%
 100% │ ██████████████████████░ │ 29.8%
      └─────────────────────────┘
 *Legend:* █ = Current Distribution 
Summary - Lines: 90.18% | Methods: 95.91%
FilesLinesMethodsBranches
/var/www/html/wp-content/plugins/gravity-pdf
   api.php98.14%100.00%100.00%
   gravity-pdf-updater.php53.97%100.00%100.00%
   pdf.php59.82%81.25%100.00%
/var/www/html/wp-content/plugins/gravity-pdf/src/Controller
   Controller_Actions.php100.00%100.00%100.00%
   Controller_Activation.php95.83%100.00%100.00%
   Controller_Custom_Fonts.php95.52%100.00%100.00%
   Controller_Debug.php100.00%100.00%100.00%
   Controller_Export_Entries.php96.77%100.00%100.00%
   Controller_Font_Downloader.php100.00%100.00%100.00%
   Controller_Font_Sources.php100.00%100.00%100.00%
   Controller_Form_Settings.php87.37%90.00%100.00%
   Controller_Install.php100.00%100.00%100.00%
   Controller_Mergetags.php100.00%100.00%100.00%
   Controller_PDF.php81.46%100.00%100.00%
   Controller_Pdf_Cache.php100.00%100.00%100.00%
   Controller_Pdf_Queue.php85.27%87.50%100.00%
   Controller_Save_Core_Fonts.php91.67%100.00%100.00%
   Controller_Settings.php86.90%100.00%100.00%
   Controller_Shortcodes.php100.00%100.00%100.00%
   Controller_System_Report.php100.00%100.00%100.00%
   Controller_Templates.php100.00%100.00%100.00%
   Controller_Uninstaller.php83.33%77.78%100.00%
   Controller_Upgrade_Routines.php95.19%100.00%100.00%
   Controller_Webhooks.php100.00%100.00%100.00%
   Controller_Zapier.php100.00%100.00%100.00%
/var/www/html/wp-content/plugins/gravity-pdf/src/Exceptions
   GravityPdfDatabaseUpdateException.php50.00%100.00%100.00%
   GravityPdfDomainException.php50.00%100.00%100.00%
   GravityPdfException.php50.00%100.00%100.00%
   GravityPdfFontNotFoundException.php50.00%100.00%100.00%
   GravityPdfIdException.php50.00%100.00%100.00%
   GravityPdfModelNotUpdatedException.php50.00%100.00%100.00%
   GravityPdfNotATemplateException.php50.00%100.00%100.00%
   GravityPdfRuntimeException.php50.00%100.00%100.00%
   GravityPdfShortcodeEntryIdException.php50.00%100.00%100.00%
   GravityPdfShortcodePdfConditionalLogicFailedException.php50.00%100.00%100.00%
   GravityPdfShortcodePdfConfigNotFoundException.php50.00%100.00%100.00%
   GravityPdfShortcodePdfInactiveException.php50.00%100.00%100.00%
/var/www/html/wp-content/plugins/gravity-pdf/src/Helper/Fields
   Field_Address.php92.86%100.00%100.00%
   Field_Chainedselect.php66.67%75.00%100.00%
   Field_Checkbox.php94.44%100.00%100.00%
   Field_Consent.php95.00%100.00%100.00%
   Field_Coupon.php--100.00%
   Field_Creditcard.php83.33%100.00%100.00%
   Field_Date.php83.33%100.00%100.00%
   Field_Default.php83.33%100.00%100.00%
   Field_Discount.php44.00%75.00%100.00%
   Field_Email.php83.33%100.00%100.00%
   Field_Fg_Ls_Consent.php92.86%100.00%100.00%
   Field_Fg_Ls_Signature.php73.08%66.67%100.00%
   Field_Fileupload.php95.83%100.00%100.00%
   Field_Form.php90.91%100.00%100.00%
   Field_Hidden.php81.82%100.00%100.00%
   Field_Html.php89.47%100.00%100.00%
   Field_Image_Choice.php86.67%100.00%100.00%
   Field_Likert.php97.22%100.00%100.00%
   Field_List.php92.41%100.00%100.00%
   Field_Multi_Choice.php50.00%100.00%100.00%
   Field_Multiselect.php92.59%100.00%100.00%
   Field_Name.php84.62%100.00%100.00%
   Field_Number.php83.33%100.00%100.00%
   Field_Option.php96.15%100.00%100.00%
   Field_Page.php83.33%100.00%100.00%
   Field_Phone.php94.55%100.00%100.00%
   Field_Poll.php93.75%100.00%100.00%
   Field_Post_Category.php85.00%100.00%100.00%
   Field_Post_Content.php82.35%100.00%100.00%
   Field_Post_Custom_Field.php50.00%100.00%100.00%
   Field_Post_Excerpt.php81.82%100.00%100.00%
   Field_Post_Image.php94.00%100.00%100.00%
   Field_Post_Tags.php90.91%100.00%100.00%
   Field_Post_Title.php81.82%100.00%100.00%
   Field_Product.php92.31%100.00%100.00%
   Field_Products.php84.32%100.00%100.00%
   Field_Quantity.php84.62%100.00%100.00%
   Field_Quiz.php89.74%100.00%100.00%
   Field_Radio.php94.74%100.00%100.00%
   Field_Rank.php95.24%100.00%100.00%
   Field_Rating.php95.24%100.00%100.00%
   Field_Repeater.php97.39%100.00%100.00%
   Field_Section.php90.74%100.00%100.00%
   Field_Select.php94.12%100.00%100.00%
   Field_Shipping.php92.86%100.00%100.00%
   Field_Signature.php71.11%100.00%100.00%
   Field_Slim.php82.35%100.00%100.00%
   Field_Slim_Post.php91.30%100.00%100.00%
   Field_Subtotal.php65.38%75.00%100.00%
   Field_Survey.php95.00%100.00%100.00%
   Field_Tax.php32.00%50.00%100.00%
   Field_Text.php81.82%100.00%100.00%
   Field_Textarea.php91.18%100.00%100.00%
   Field_Time.php81.82%100.00%100.00%
   Field_Tos.php92.86%100.00%100.00%
   Field_Total.php88.00%100.00%100.00%
   Field_Website.php85.71%100.00%100.00%
/var/www/html/wp-content/plugins/gravity-pdf/src/Helper/Fonts
   FlushCache.php92.31%100.00%100.00%
   LocalFile.php88.89%100.00%100.00%
   LocalFilesystem.php66.67%100.00%100.00%
   SupportsOtl.php87.50%100.00%100.00%
   TtfFontValidation.php84.62%100.00%100.00%
/var/www/html/wp-content/plugins/gravity-pdf/src/Helper
   Helper_Abstract_Addon.php94.09%100.00%100.00%
   Helper_Abstract_Config_Settings.php75.00%100.00%100.00%
   Helper_Abstract_Controller.php-100.00%100.00%
   Helper_Abstract_Field_Products.php89.47%66.67%100.00%
   Helper_Abstract_Fields.php96.10%95.83%100.00%
   Helper_Abstract_Fields_Input_Type.php84.00%100.00%100.00%
   Helper_Abstract_Form.php--100.00%
   Helper_Abstract_Model.php100.00%100.00%100.00%
   Helper_Abstract_Options.php77.33%81.36%100.00%
   Helper_Abstract_Pdf_Shortcode.php94.67%95.65%100.00%
   Helper_Abstract_View.php96.77%100.00%100.00%
   Helper_Async_Notifications.php64.29%100.00%100.00%
   Helper_Data.php98.43%100.00%100.00%
   Helper_Field_Container.php92.31%100.00%100.00%
   Helper_Field_Container_Gf25.php92.00%100.00%100.00%
   Helper_Field_Container_Void.php16.67%-100.00%
   Helper_Form.php80.65%64.29%100.00%
   Helper_Interface_Actions.php-100.00%100.00%
   Helper_Interface_Config.php50.00%100.00%100.00%
   Helper_Interface_Config_Settings.php50.00%100.00%100.00%
   Helper_Interface_Deprecated_Features.php50.00%100.00%100.00%
   Helper_Interface_Extension_Settings.php-100.00%100.00%
   Helper_Interface_Extension_Uninstaller.php-100.00%100.00%
   Helper_Interface_Field_Pdf_Config.php50.00%100.00%100.00%
   Helper_Interface_Filters.php-100.00%100.00%
   Helper_Interface_Setup_TearDown.php50.00%100.00%100.00%
   Helper_Interface_Url_Signer.php-100.00%100.00%
   Helper_Logger.php-100.00%100.00%
   Helper_Misc.php89.17%100.00%100.00%
   Helper_Mpdf.php50.00%100.00%100.00%
   Helper_Notices.php92.98%100.00%100.00%
   Helper_Options_Fields.php98.10%100.00%100.00%
   Helper_PDF.php88.61%97.56%100.00%
   Helper_PDF_List_Table.php84.50%92.31%100.00%
   Helper_Pdf_Queue.php84.31%100.00%100.00%
   Helper_QueryPath.php80.00%100.00%100.00%
   Helper_Render_Health.php85.71%100.00%100.00%
   Helper_Sha256_Url_Signer.php90.91%100.00%100.00%
   Helper_Singleton.php100.00%100.00%100.00%
   Helper_Templates.php97.29%100.00%100.00%
   Helper_Trait_Logger.php25.00%-100.00%
   Helper_Trait_Removed_Methods.php100.00%100.00%100.00%
   Helper_Url_Signer.php84.82%100.00%100.00%
/var/www/html/wp-content/plugins/gravity-pdf/src/Helper/Licensing
Table truncated to fit comment

🤖 PHPUnit coverage report

@gravitypdf-bot
gravitypdf-bot force-pushed the refactor/hook-only-deprecations branch 2 times, most recently from e722e41 to 2e3aa47 Compare November 6, 2026 00:34
@gravitypdf-bot
gravitypdf-bot changed the base branch from feature/core-font-upgrade-prune to feature/font-file-conflict-rename November 6, 2026 00:35
@jakejackson1
jakejackson1 force-pushed the feature/font-file-conflict-rename branch from f7acf3e to 74c3b06 Compare November 6, 2026 03:07
@gravitypdf-bot
gravitypdf-bot force-pushed the feature/font-file-conflict-rename branch 3 times, most recently from 62cbe50 to 38e02af Compare November 9, 2026 06:09
Base automatically changed from feature/font-file-conflict-rename to development November 9, 2026 06:12
@gravitypdf-bot
gravitypdf-bot force-pushed the refactor/hook-only-deprecations branch 3 times, most recently from f00aa8f to addb4de Compare November 9, 2026 23:03
@gravitypdf-bot gravitypdf-bot changed the title Report hook-only deprecations generically and deprecate the dead action/settings button APIs Report hook-only deprecations generically and deprecate the dead action button dismissal argument Nov 9, 2026
@gravitypdf-bot
gravitypdf-bot force-pushed the refactor/hook-only-deprecations branch from addb4de to ebff3b4 Compare November 9, 2026 23:34
@gravitypdf-bot
gravitypdf-bot force-pushed the refactor/hook-only-deprecations branch from ebff3b4 to 884a941 Compare November 9, 2026 23:44
@gravitypdf-bot gravitypdf-bot changed the title Report hook-only deprecations generically and deprecate the dead action button dismissal argument Report hook-only deprecations generically and run the Tools tab hooks on the General tab Nov 9, 2026
@gravitypdf-bot
gravitypdf-bot force-pushed the refactor/hook-only-deprecations branch 4 times, most recently from d2d730a to 8fc2639 Compare November 10, 2026 00:35
… on the General tab

A removal that leaves nothing behind but its hooks no longer needs a detector of its own: Deprecation reports the
third-party listeners on a feature's `hooks` (plus `hook_prefix`, minus `internal_callbacks`) when it declares no
`detect`, and View_System_Report describes such a feature by its listener counts instead of looking its ID up in
get_deprecated_feature_descriptions(), so a new hook feature left out of that map keeps its counts. Both ask
Deprecation::is_hook_only(), so a feature with hooks and its own detector keeps its own description.

- New Deprecation_Hooks provider holds `tools_tab_hooks`, and is where any later hook-only round goes. It replaces
  Deprecation_Tools_Tab, which is deleted outright as it has never been in a release.
- The Tools tab hooks keep running at the bottom of the General tab until 7.0, for users who can edit settings:
  gfpdf_settings_tools' fields under a Tools heading in their own form, as they were never saved through options.php,
  followed by gfpdf_post_tools_settings_page. As they still work the feature moves to the deprecated group, which
  gives Site Health Info a Deprecated panel.
- Deprecation_V3's `deprecated_filters` drops its `detect` and takes the generic path. get_active_deprecated_filters()
  is left with no internal caller, so it is deprecated in favour of Deprecation::get_signals(), and still works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gravitypdf-bot
gravitypdf-bot force-pushed the refactor/hook-only-deprecations branch from 8fc2639 to b571ce2 Compare November 10, 2026 00:38
@jakejackson1
jakejackson1 merged commit 0b6e544 into development Nov 10, 2026
@jakejackson1
jakejackson1 deleted the refactor/hook-only-deprecations branch November 10, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants