mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-15 11:59:56 +00:00
Merge pull request #8366 from Wikia/DAT-3194
Dat 3194 - for videos in infobox use link to file page instead of link to original image
This commit is contained in:
commit
9767ef0d50
|
@ -110,8 +110,14 @@ class NodeImage extends Node {
|
|||
* @return array
|
||||
*/
|
||||
private function videoDataDecorator( $data, $file ) {
|
||||
$data['isVideo'] = true;
|
||||
$data['duration'] = WikiaFileHelper::formatDuration( $file->getMetadataDuration());
|
||||
$title = $file->getTitle();
|
||||
|
||||
if ( $title ) {
|
||||
$data[ 'url' ] = $title->getFullURL();
|
||||
}
|
||||
|
||||
$data[ 'isVideo' ] = true;
|
||||
$data[ 'duration' ] = WikiaFileHelper::formatDuration( $file->getMetadataDuration());
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
|
|
@ -112,12 +112,12 @@ class NodeImageTest extends WikiaBaseTest {
|
|||
'<image source="img" />',
|
||||
[ 'img' => 'test.jpg' ],
|
||||
[
|
||||
'url' => '',
|
||||
'url' => 'http://test.url',
|
||||
'name' => 'Test.jpg',
|
||||
'key' => 'Test.jpg',
|
||||
'alt' => null,
|
||||
'caption' => null,
|
||||
'ref' => 0,
|
||||
'ref' => null,
|
||||
'isVideo' => true,
|
||||
'duration' => '00:10'
|
||||
]
|
||||
|
@ -138,4 +138,14 @@ class FileMock {
|
|||
public function getUrl() {
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getTitle() {
|
||||
return new TitleMock();
|
||||
}
|
||||
}
|
||||
|
||||
class TitleMock {
|
||||
public function getFullURL() {
|
||||
return 'http://test.url';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue