Audio
1 day ago
Video
1 day ago
AttachmentMetaData.php
1 day ago
AttachmentUrl.php
1 day ago
AudioPlayer.php
1 day ago
AvailableSizes.php
1 day ago
Dimensions.php
1 day ago
Download.php
1 day ago
ExifData.php
1 day ago
FileLinkToUrl.php
1 day ago
FileName.php
1 day ago
FileSize.php
1 day ago
Link.php
1 day ago
NestedAttachmentMetaData.php
1 day ago
NumberFormat.php
1 day ago
PostMimeType.php
1 day ago
PreviewViewLink.php
1 day ago
VideoEmbed.php
1 day ago
VideoEmbed.php
26 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Formatter\Media; |
| 6 | |
| 7 | use AC\Formatter; |
| 8 | use AC\Type\Value; |
| 9 | use AC\View\Embed\Video; |
| 10 | |
| 11 | class VideoEmbed implements Formatter |
| 12 | { |
| 13 | public function format(Value $value): Value |
| 14 | { |
| 15 | if (! $value->get_value()) { |
| 16 | return $value; |
| 17 | } |
| 18 | |
| 19 | $view = new Video(); |
| 20 | $view->set_src($value->get_value()); |
| 21 | |
| 22 | return $value->with_value($view->render()); |
| 23 | } |
| 24 | |
| 25 | } |
| 26 |