Add class-level customization and visibility control for TemplateHooks.
Review Request #14556 — Created Aug. 6, 2025 and submitted — Latest diff uploaded
TemplateHookhas always requiredname,template_name,apply_to,
andextra_contextto be passed into__init__(), even in a subclass.
This makes usage a bit verbose.This change adds new class-level control of these options. Now, a
subclass can define these as class attributes and they'll be used if the
caller doesn't override any of them with a parameter.Subclasses can also opt out of rendering by overriding
should_render(), which means they no longer need to handle this in a
template.
Unit tests pass.
Tested this with the banner component work in Review Board, utilizing
the new features.
