Page MenuHomePhabricator

Move "templates on this page" logic out of EditPage
Open, MediumPublic

Description

ApiVisualEditor constructs on EditPage to be able to retrieve the formatted "templates on this page" list.
It should be possible to get the formatted list without using an EditPage object

While a new system is being created for retrieving the formatted list, TemplatesOnThisPageFormatter should have a factory rather than callers needing to independently provide a LinkRenderer, and the PermissionManager that is used should be injected rather than retrieved from MediaWikiServices::getInstance()

Plan:

  • Add a TemplatesOnThisPageFormatterFactory to create TemplatesOnThisPageFormatter objects
  • Add a method to the Formatter to get the list wrapped in a div with the templatesUsed class, as currently provided by EditPage::makeTemplatesOnThisPageList
  • Add a PermissionManager as an optional dependency, hard deprecate not providing it (callers should not construct the class directly, but should use the factory)
  • Replace the use of the EditPage object in ApiVisualEditor that relies on makeTemplatesOnThisPageList (use the new factory instead)
  • Deprecate EditPage::makeTemplatesOnThisPageList

Event Timeline

Change 596889 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] [EditPage] Add TemplatesOnThisPageFormatter::formatDiv and Factory

https://gerrit.wikimedia.org/r/596889

JTannerWMF added subscribers: eprodromou, JTannerWMF.

Hey @eprodromou , ping me if you need the Editing team to take a look at this

@Pchelolo @daniel would you be willing to take a look at the patch?