mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-15 20:09:44 +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
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function videoDataDecorator( $data, $file ) {
|
private function videoDataDecorator( $data, $file ) {
|
||||||
$data['isVideo'] = true;
|
$title = $file->getTitle();
|
||||||
$data['duration'] = WikiaFileHelper::formatDuration( $file->getMetadataDuration());
|
|
||||||
|
if ( $title ) {
|
||||||
|
$data[ 'url' ] = $title->getFullURL();
|
||||||
|
}
|
||||||
|
|
||||||
|
$data[ 'isVideo' ] = true;
|
||||||
|
$data[ 'duration' ] = WikiaFileHelper::formatDuration( $file->getMetadataDuration());
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,12 +112,12 @@ class NodeImageTest extends WikiaBaseTest {
|
||||||
'<image source="img" />',
|
'<image source="img" />',
|
||||||
[ 'img' => 'test.jpg' ],
|
[ 'img' => 'test.jpg' ],
|
||||||
[
|
[
|
||||||
'url' => '',
|
'url' => 'http://test.url',
|
||||||
'name' => 'Test.jpg',
|
'name' => 'Test.jpg',
|
||||||
'key' => 'Test.jpg',
|
'key' => 'Test.jpg',
|
||||||
'alt' => null,
|
'alt' => null,
|
||||||
'caption' => null,
|
'caption' => null,
|
||||||
'ref' => 0,
|
'ref' => null,
|
||||||
'isVideo' => true,
|
'isVideo' => true,
|
||||||
'duration' => '00:10'
|
'duration' => '00:10'
|
||||||
]
|
]
|
||||||
|
@ -138,4 +138,14 @@ class FileMock {
|
||||||
public function getUrl() {
|
public function getUrl() {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTitle() {
|
||||||
|
return new TitleMock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TitleMock {
|
||||||
|
public function getFullURL() {
|
||||||
|
return 'http://test.url';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue