| 1 |
<?php |
| 2 |
|
| 3 |
declare (strict_types=1); |
| 4 |
namespace Amiut\ProductSpecs\Shortcode; |
| 5 |
|
| 6 |
use Amiut\ProductSpecs\Repository\SpecificationsTableRepository; |
| 7 |
use Amiut\ProductSpecs\Template\TemplateRenderer; |
| 8 |
use ProductSpecifications\Vendor\Inpsyde\Modularity\Module\ExecutableModule; |
| 9 |
use ProductSpecifications\Vendor\Inpsyde\Modularity\Module\ModuleClassNameIdTrait; |
| 10 |
use ProductSpecifications\Vendor\Inpsyde\Modularity\Module\ServiceModule; |
| 11 |
use Psr\Container\ContainerInterface; |
| 12 |
final class Module implements ServiceModule, ExecutableModule |
| 13 |
{ |
| 14 |
use ModuleClassNameIdTrait; |
| 15 |
public function services(): array |
| 16 |
{ |
| 17 |
return [\Amiut\ProductSpecs\Shortcode\SpecificationsTable::class => static fn(ContainerInterface $container) => new \Amiut\ProductSpecs\Shortcode\SpecificationsTable($container->get(TemplateRenderer::class), $container->get(SpecificationsTableRepository::class))]; |
| 18 |
} |
| 19 |
public function run(ContainerInterface $container): bool |
| 20 |
{ |
| 21 |
$tableShortcode = $container->get(\Amiut\ProductSpecs\Shortcode\SpecificationsTable::class); |
| 22 |
add_action('init', static function () use ($tableShortcode) { |
| 23 |
add_shortcode(\Amiut\ProductSpecs\Shortcode\SpecificationsTable::KEY, [$tableShortcode, 'render']); |
| 24 |
}); |
| 25 |
return \true; |
| 26 |
} |
| 27 |
} |
| 28 |
|