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