34 lines
1.2 KiB
Bash
34 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
cat <<EOM > admin/services/provider.php
|
|
|
|
<?php defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
|
|
use Joomla\CMS\Extension\ComponentInterface;
|
|
use Joomla\CMS\Extension\MVCComponent;
|
|
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
|
|
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
|
|
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
|
use Joomla\DI\Container;
|
|
use Joomla\DI\ServiceProviderInterface;
|
|
|
|
return new class implements ServiceProviderInterface {
|
|
|
|
public function register(Container \$container): void {
|
|
\$container->registerServiceProvider(new MVCFactory('\\\\Harvst\\\\Component\\\\${name^}'));
|
|
\$container->registerServiceProvider(new ComponentDispatcherFactory('\\\\Harvst\\\\Component\\\\${name^}'));
|
|
\$container->set(
|
|
ComponentInterface::class,
|
|
function (Container \$container) {
|
|
\$component = new MVCComponent(\$container->get(ComponentDispatcherFactoryInterface::class));
|
|
\$component->setMVCFactory(\$container->get(MVCFactoryInterface::class));
|
|
|
|
return \$component;
|
|
}
|
|
);
|
|
}
|
|
};
|
|
|
|
EOM
|