AlbumFactory.php
2 days ago
AlternateTextFactory.php
2 days ago
ArtistFactory.php
2 days ago
AudioPlayerFactory.php
2 days ago
AvailableSizesFactory.php
2 days ago
CaptionFactory.php
2 days ago
DimensionsFactory.php
2 days ago
DownloadFactory.php
2 days ago
ExifDataFactory.php
2 days ago
FileMetaAudioFactory.php
2 days ago
FileMetaVideoFactory.php
2 days ago
FileNameFactory.php
2 days ago
FileSizeFactory.php
2 days ago
FullPathFactory.php
2 days ago
HeightFactory.php
2 days ago
ImageFactory.php
2 days ago
MimeTypeFactory.php
2 days ago
PreviewFactory.php
2 days ago
VideoPlayerFactory.php
2 days ago
WidthFactory.php
2 days ago
FileMetaVideoFactory.php
61 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\ColumnFactory\Media; |
| 6 | |
| 7 | use AC\Column\BaseColumnFactory; |
| 8 | use AC\Formatter\Media\NestedAttachmentMetaData; |
| 9 | use AC\FormatterCollection; |
| 10 | use AC\Setting\ComponentCollection; |
| 11 | use AC\Setting\ComponentFactory\Media\FileMetaVideo; |
| 12 | use AC\Setting\Config; |
| 13 | use AC\Setting\DefaultSettingsBuilder; |
| 14 | |
| 15 | class FileMetaVideoFactory extends BaseColumnFactory |
| 16 | { |
| 17 | private FileMetaVideo $file_meta_video; |
| 18 | |
| 19 | public function __construct( |
| 20 | DefaultSettingsBuilder $default_settings_builder, |
| 21 | FileMetaVideo $file_meta_video |
| 22 | ) { |
| 23 | parent::__construct($default_settings_builder); |
| 24 | |
| 25 | $this->file_meta_video = $file_meta_video; |
| 26 | } |
| 27 | |
| 28 | protected function get_settings(Config $config): ComponentCollection |
| 29 | { |
| 30 | return new ComponentCollection([ |
| 31 | $this->file_meta_video->create($config), |
| 32 | ]); |
| 33 | } |
| 34 | |
| 35 | public function get_column_type(): string |
| 36 | { |
| 37 | return 'column-meta_video'; |
| 38 | } |
| 39 | |
| 40 | public function get_label(): string |
| 41 | { |
| 42 | return __('Video Meta', 'codepress-admin-columns'); |
| 43 | } |
| 44 | |
| 45 | protected function get_group(): ?string |
| 46 | { |
| 47 | return 'media-video'; |
| 48 | } |
| 49 | |
| 50 | protected function get_formatters(Config $config): FormatterCollection |
| 51 | { |
| 52 | $formatters = parent::get_formatters($config); |
| 53 | $meta_keys = array_filter(array_map('trim', explode('.', $config->get('media_meta_key', '')))); |
| 54 | |
| 55 | $formatters->prepend(new NestedAttachmentMetaData($meta_keys)); |
| 56 | |
| 57 | return $formatters; |
| 58 | } |
| 59 | |
| 60 | } |
| 61 |