+ /**
+ * Get recommended data attributes for a change line.
+ * @param RecentChange $rc
+ * @return string[] attribute name => value
+ */
+ protected function getDataAttributes( RecentChange $rc ) {
+ $attrs = [];
+
+ $type = $rc->getAttribute( 'rc_source' );
+ switch ( $type ) {
+ case RecentChange::SRC_EDIT:
+ case RecentChange::SRC_NEW:
+ $attrs['data-mw-revid'] = $rc->mAttribs['rc_this_oldid'];
+ break;
+ case RecentChange::SRC_LOG:
+ $attrs['data-mw-logid'] = $rc->mAttribs['rc_logid'];
+ $attrs['data-mw-logaction'] =
+ $rc->mAttribs['rc_log_type'] . '/' . $rc->mAttribs['rc_log_action'];
+ break;
+ }
+
+ $attrs[ 'data-mw-ts' ] = $rc->getAttribute( 'rc_timestamp' );
+
+ return $attrs;
+ }
+
+ /**
+ * Sets the callable that generates a change line prefix added to the beginning of each line.
+ *
+ * @param callable $prefixer Callable to run that generates the change line prefix.
+ * Takes three parameters: a RecentChange object, a ChangesList object,
+ * and whether the current entry is a grouped entry.
+ */
+ public function setChangeLinePrefixer( callable $prefixer ) {
+ $this->changeLinePrefixer = $prefixer;
+ }