Aggregate.php
5 months ago
BaseFactory.php
5 months ago
CommentFactory.php
5 months ago
IntegrationFactory.php
5 months ago
MediaFactory.php
5 months ago
OriginalFactory.php
5 months ago
PostFactory.php
5 months ago
ThirdPartyFactory.php
5 months ago
UserFactory.php
5 months ago
MediaFactory.php
58 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\ColumnFactories; |
| 6 | |
| 7 | use AC; |
| 8 | use AC\ColumnFactory\Media; |
| 9 | use AC\ColumnFactoryDefinitionCollection; |
| 10 | use AC\TableScreen; |
| 11 | |
| 12 | final class MediaFactory extends BaseFactory |
| 13 | { |
| 14 | |
| 15 | protected function get_factories(TableScreen $table_screen): ColumnFactoryDefinitionCollection |
| 16 | { |
| 17 | $collection = new ColumnFactoryDefinitionCollection(); |
| 18 | |
| 19 | if ( ! $table_screen instanceof AC\TableScreen\Media) { |
| 20 | return $collection; |
| 21 | } |
| 22 | |
| 23 | $factories = [ |
| 24 | Media\AlbumFactory::class, |
| 25 | Media\AlternateTextFactory::class, |
| 26 | Media\ArtistFactory::class, |
| 27 | Media\AudioPlayerFactory::class, |
| 28 | Media\AvailableSizesFactory::class, |
| 29 | Media\CaptionFactory::class, |
| 30 | Media\DimensionsFactory::class, |
| 31 | Media\DownloadFactory::class, |
| 32 | Media\FileMetaAudioFactory::class, |
| 33 | Media\FileMetaVideoFactory::class, |
| 34 | Media\FileNameFactory::class, |
| 35 | Media\FileSizeFactory::class, |
| 36 | Media\FullPathFactory::class, |
| 37 | Media\HeightFactory::class, |
| 38 | Media\ImageFactory::class, |
| 39 | Media\MimeTypeFactory::class, |
| 40 | Media\PreviewFactory::class, |
| 41 | Media\VideoPlayerFactory::class, |
| 42 | Media\WidthFactory::class, |
| 43 | ]; |
| 44 | |
| 45 | if (function_exists('exif_read_data')) { |
| 46 | $factories[] = Media\ExifDataFactory::class; |
| 47 | } |
| 48 | |
| 49 | foreach ($factories as $factory) { |
| 50 | $collection->add( |
| 51 | new AC\Type\ColumnFactoryDefinition($factory) |
| 52 | ); |
| 53 | } |
| 54 | |
| 55 | return $collection; |
| 56 | } |
| 57 | |
| 58 | } |