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
IntegrationFactory.php
43 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\ColumnFactories; |
| 6 | |
| 7 | use AC; |
| 8 | use AC\ColumnFactoryDefinitionCollection; |
| 9 | use AC\DI\Container; |
| 10 | use AC\TableScreen; |
| 11 | |
| 12 | final class IntegrationFactory extends BaseFactory |
| 13 | { |
| 14 | |
| 15 | private AC\Integration\IntegrationRepository $repository; |
| 16 | |
| 17 | public function __construct(Container $container, AC\Integration\IntegrationRepository $integration_repository) |
| 18 | { |
| 19 | $this->repository = $integration_repository; |
| 20 | parent::__construct($container); |
| 21 | } |
| 22 | |
| 23 | protected function get_factories(TableScreen $table_screen): ColumnFactoryDefinitionCollection |
| 24 | { |
| 25 | $collection = new ColumnFactoryDefinitionCollection(); |
| 26 | |
| 27 | foreach ($this->repository->find_all_by_active_plugins() as $integration) { |
| 28 | if ($integration->show_placeholder($table_screen)) { |
| 29 | $collection->add( |
| 30 | new AC\Type\ColumnFactoryDefinition( |
| 31 | AC\ColumnFactory\IntegrationPlaceholder::class, |
| 32 | [ |
| 33 | 'integration' => $integration, |
| 34 | ] |
| 35 | ) |
| 36 | ); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | return $collection; |
| 41 | } |
| 42 | |
| 43 | } |