*
* This text-based implementation uses wfMerge().
*
- * @param Content|string $oldContent The page's previous content.
- * @param Content|string $myContent One of the page's conflicting contents.
- * @param Content|string $yourContent One of the page's conflicting contents.
+ * @param Content $oldContent The page's previous content.
+ * @param Content $myContent One of the page's conflicting contents.
+ * @param Content $yourContent One of the page's conflicting contents.
*
* @return Content|bool
*/
return $mergedContent;
}
+ /**
+ * Returns the name of the associated Content class, to
+ * be used when creating new objects. Override expected
+ * by subclasses.
+ *
+ * @since 1.24
+ *
+ * @return string
+ */
+ protected function getContentClass() {
+ return 'TextContent';
+ }
+
/**
* Unserializes a Content object of the type supported by this ContentHandler.
*
public function unserializeContent( $text, $format = null ) {
$this->checkFormat( $format );
- return new TextContent( $text );
+ $class = $this->getContentClass();
+ return new $class( $text );
}
/**
* @return Content A new TextContent object with empty text.
*/
public function makeEmptyContent() {
- return new TextContent( '' );
+ $class = $this->getContentClass();
+ return new $class( '' );
}
}