localizer = $localizer; $this->out = $out; $this->pageLang = $pageLang; $this->title = $title; $this->user = $user; } /** * Get the last modified data * TODO: Use core instead when update to MW 1.43 * @return array */ private function getLastModData() { $timestamp = $this->out->getRevisionTimestamp(); if ( !$timestamp ) { return []; } $localizer = $this->localizer; $pageLang = $this->pageLang; $title = $this->title; $user = $this->user; $d = $pageLang->userDate( $timestamp, $user ); $t = $pageLang->userTime( $timestamp, $user ); $s = $localizer->msg( 'lastmodifiedat', $d, $t ); // FIXME: Use CitizenComponentMenuListItem $items = [ 'item-id' => 'lm-time', 'item-class' => 'mw-list-item', 'array-links' => [ 'array-attributes' => [ [ 'key' => 'id', 'value' => 'citizen-lastmod-relative' ], [ 'key' => 'href', 'value' => $title->getLocalURL( [ 'diff' => '' ] ) ], [ 'key' => 'title', 'value' => $s ], [ 'key' => 'data-timestamp', 'value' => wfTimestamp( TS_UNIX, $timestamp ) ] ], 'icon' => 'history', 'text' => $d ] ]; $menu = new CitizenComponentMenu( [ 'id' => 'citizen-sidebar-lastmod', 'label' => $localizer->msg( 'citizen-page-info-lastmod' ), 'array-list-items' => $items ] ); return $menu->getTemplateData(); } /** * @inheritDoc */ public function getTemplateData(): array { return [ 'data-page-sidebar-lastmod' => $this->getLastModData() ]; } }