MediaWiki
1.32.5
|
Renders a diff for a single slot (that is, a diff between two content objects). More...
Public Member Functions | |
addModules (OutputPage $output) | |
Add modules needed for correct styling/behavior of the diff. More... | |
getDiff (Content $oldContent=null, Content $newContent=null) | |
Get a diff between two content objects. More... | |
getExtraCacheKeys () | |
Return any extra keys to split the diff cache by. More... | |
Protected Member Functions | |
normalizeContents (Content &$oldContent=null, Content &$newContent=null, $allowedClasses=null) | |
Helper method to normalize the input of getDiff(). More... | |
Renders a diff for a single slot (that is, a diff between two content objects).
Callers should obtain this class by invoking ContentHandler::getSlotDiffRendererClass on the content handler of the new content object (ie. the one shown on the right side of the diff), or of the old one if the new one does not exist.
The default implementation just does a text diff on the native text representation. Content handler extensions can subclass this to provide a more appropriate diff method by overriding ContentHandler::getSlotDiffRendererClass. Other extensions that want to interfere with diff generation in some way can use the GetSlotDiffRenderer hook.
Definition at line 39 of file SlotDiffRenderer.php.
SlotDiffRenderer::addModules | ( | OutputPage | $output | ) |
Add modules needed for correct styling/behavior of the diff.
OutputPage | $output |
Reimplemented in DifferenceEngineSlotDiffRenderer.
Definition at line 55 of file SlotDiffRenderer.php.
Get a diff between two content objects.
One of them might be null (meaning a slot was created or removed), but both cannot be. $newContent (or if it's null then $oldContent) must have the same content model that was used to obtain this diff renderer.
Reimplemented in TextSlotDiffRenderer, and DifferenceEngineSlotDiffRenderer.
SlotDiffRenderer::getExtraCacheKeys | ( | ) |
Return any extra keys to split the diff cache by.
Reimplemented in DifferenceEngineSlotDiffRenderer.
Definition at line 62 of file SlotDiffRenderer.php.
|
protected |
Helper method to normalize the input of getDiff().
Verifies that at least one of $oldContent and $newContent is not null, verifies that they are instances of one of the allowed classes (if provided), and replaces null with empty content.
Content | null | &$oldContent | |
Content | null | &$newContent | |
string | array | null | $allowedClasses |
Definition at line 75 of file SlotDiffRenderer.php.
Referenced by DifferenceEngineSlotDiffRenderer\getDiff(), and TextSlotDiffRenderer\getDiff().