-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from sergeytolkachyov/dev
v.1.0.2
- Loading branch information
Showing
16 changed files
with
363 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* @package WT JShopping Cart | ||
* | ||
* @copyright (C) 2022 Sergey Tolkachyov | ||
* @link https://web-tolk.ru | ||
* @license GNU General Public License version 2 or later | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
use Joomla\CMS\Extension\Service\Provider\HelperFactory; | ||
use Joomla\CMS\Extension\Service\Provider\Module; | ||
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory; | ||
use Joomla\DI\Container; | ||
use Joomla\DI\ServiceProviderInterface; | ||
|
||
/** | ||
* The WT JShopping Cart module service provider. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
return new class implements ServiceProviderInterface { | ||
/** | ||
* Registers the service provider with a DI container. | ||
* | ||
* @param Container $container The DI container. | ||
* | ||
* @return void | ||
* | ||
* @since 4.0.0 | ||
*/ | ||
public function register(Container $container) | ||
{ | ||
// Основной namespace модуля | ||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Wtjshoppingcart')); | ||
// Namespace модуля для хелпера | ||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Wtjshoppingcart\\Site\\Helper')); | ||
// Namespace модуля для своих типов полей | ||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Wtjshoppingcart\\Site\\Fields')); | ||
$container->registerServiceProvider(new Module); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
/** | ||
* @package WT Yandex Map items | ||
* | ||
* @copyright (C) 2022 Sergey Tolkachyov | ||
* @link https://web-tolk.ru | ||
* @license GNU General Public License version 2 or later | ||
*/ | ||
|
||
namespace Joomla\Module\Wtjshoppingcart\Site\Dispatcher; | ||
|
||
\defined('JPATH_PLATFORM') or die; | ||
|
||
use Exception; | ||
use Joomla\CMS\Application\CMSApplicationInterface; | ||
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher; | ||
use Joomla\CMS\Extension\ModuleInterface; | ||
use Joomla\Input\Input; | ||
use Joomla\Module\Wtjshoppingcart\Site\Helper\WtjshoppingcartHelper; | ||
|
||
/** | ||
* Dispatcher class for mod_wtyandexmapitems | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
class Dispatcher extends AbstractModuleDispatcher | ||
{ | ||
|
||
/** | ||
* The module extension. Used to fetch the module helper. | ||
* | ||
* @var ModuleInterface|null | ||
* @since 1.1.0 | ||
*/ | ||
private $moduleExtension; | ||
|
||
|
||
public function __construct(\stdClass $module, CMSApplicationInterface $app, Input $input) | ||
{ | ||
parent::__construct($module, $app, $input); | ||
|
||
$this->moduleExtension = $this->app->bootModule('mod_wtjshoppingcart', 'site'); | ||
} | ||
|
||
/** | ||
* Returns the layout data. | ||
* | ||
* @return array | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
protected function getLayoutData() : array | ||
{ | ||
if (!file_exists(JPATH_SITE . '/administrator/components/com_jshopping/jshopping.xml')) | ||
{ | ||
throw new Exception('Please install JoomShopping', 500); | ||
} | ||
if(!class_exists('JSHelper')){ | ||
require_once(JPATH_SITE . '/components/com_jshopping/bootstrap.php'); | ||
} | ||
|
||
$data = parent::getLayoutData(); | ||
|
||
\JSFactory::loadCssFiles(); | ||
\JSFactory::loadLanguageFile(); | ||
|
||
$data['jshopConfig'] = \JSFactory::getConfig(); | ||
$data['cart'] = WtjshoppingcartHelper::getCart($data['params'], $this->getApplication()); | ||
|
||
return $data; | ||
} | ||
} |
Oops, something went wrong.