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