Page MenuHomePhabricator

Add a hook to EntityContent::getParserOutput to allow other extensions to register additional extension data
Closed, DuplicatePublic

Description

When Wikibase generates ParserOutput (in EntityParserOutputGenerator), I think this would be the right time for other extensions (e.g. GeoData and PageImages) to register additional extension data in the ParserOutput.

I think that would provide what GeoData and PageImages need to integrate with Wikibase.

Event Timeline

aude raised the priority of this task from to Medium.
aude updated the task description. (Show Details)
aude subscribed.

alternatively, the hook(s) might be able to go in EntityContent::getParserOutput and/or getSecondaryDataUpdates

aude renamed this task from Add a hook to EntityParserOutputGenerator to allow other extensions to register additional extension data to Add a hook to EntityContent::getParserOutput to allow other extensions to register additional extension data.Sep 29 2015, 2:44 PM
aude set Security to None.

a more performant option might be something like the visitor pattern when we traverse all the snaks.

we already traverse all snaks in ReferencedEntitiesFinder and that is somewhat slow. We should traverse only once when generating parser output.

We can register multiple 'visitors' and for each snak, they can optionally do something and register some data, and have a method to get the data after traversing.

via a hook or registry, GeoData could register a visitor for getting coordinates, there could be one for PageImages, and ones for other stuff we currently do.