AlbumFactory.php
3 months ago
AlternateTextFactory.php
3 months ago
ArtistFactory.php
3 months ago
AudioPlayerFactory.php
3 months ago
AvailableSizesFactory.php
3 months ago
CaptionFactory.php
3 months ago
DimensionsFactory.php
3 months ago
DownloadFactory.php
3 months ago
ExifDataFactory.php
3 months ago
FileMetaAudioFactory.php
3 months ago
FileMetaVideoFactory.php
3 months ago
FileNameFactory.php
3 months ago
FileSizeFactory.php
3 months ago
FullPathFactory.php
3 months ago
HeightFactory.php
3 months ago
ImageFactory.php
3 months ago
MimeTypeFactory.php
3 months ago
PreviewFactory.php
3 months ago
VideoPlayerFactory.php
3 months ago
WidthFactory.php
3 months ago
FileMetaAudioFactory.php
58 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\AttachmentMetaData; |
| 9 | use AC\FormatterCollection; |
| 10 | use AC\Setting\ComponentCollection; |
| 11 | use AC\Setting\ComponentFactory\Media\FileMetaAudio; |
| 12 | use AC\Setting\Config; |
| 13 | use AC\Setting\DefaultSettingsBuilder; |
| 14 | |
| 15 | class FileMetaAudioFactory extends BaseColumnFactory |
| 16 | { |
| 17 | |
| 18 | private FileMetaAudio $audio_meta; |
| 19 | |
| 20 | public function __construct( |
| 21 | DefaultSettingsBuilder $default_settings_builder, |
| 22 | FileMetaAudio $audio_meta |
| 23 | ) { |
| 24 | parent::__construct($default_settings_builder); |
| 25 | |
| 26 | $this->audio_meta = $audio_meta; |
| 27 | } |
| 28 | |
| 29 | protected function get_settings(Config $config): ComponentCollection |
| 30 | { |
| 31 | return new ComponentCollection([ |
| 32 | $this->audio_meta->create($config), |
| 33 | ]); |
| 34 | } |
| 35 | |
| 36 | public function get_column_type(): string |
| 37 | { |
| 38 | return 'column-meta_audio'; |
| 39 | } |
| 40 | |
| 41 | public function get_label(): string |
| 42 | { |
| 43 | return __('Audio Meta', 'codepress-admin-columns'); |
| 44 | } |
| 45 | |
| 46 | protected function get_group(): ?string |
| 47 | { |
| 48 | return 'media-audio'; |
| 49 | } |
| 50 | |
| 51 | protected function get_formatters(Config $config): FormatterCollection |
| 52 | { |
| 53 | $formatters = parent::get_formatters($config); |
| 54 | |
| 55 | return $formatters->prepend(new AttachmentMetaData((string)$config->get('media_meta_key'))); |
| 56 | } |
| 57 | |
| 58 | } |