-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '4.4-dev' into providers/plugins/system
- Loading branch information
Showing
6 changed files
with
157 additions
and
36 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* @package Joomla.Site | ||
* @subpackage mod_breadcrumbs | ||
* | ||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org> | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
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 breadcrumbs module service provider. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
return new class () implements ServiceProviderInterface { | ||
/** | ||
* Registers the service provider with a DI container. | ||
* | ||
* @param Container $container The DI container. | ||
* | ||
* @return void | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function register(Container $container): void | ||
{ | ||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Breadcrumbs')); | ||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Breadcrumbs\\Site\\Helper')); | ||
|
||
$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,50 @@ | ||
<?php | ||
|
||
/** | ||
* @package Joomla.Site | ||
* @subpackage mod_breadcrumbs | ||
* | ||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org> | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
namespace Joomla\Module\Breadcrumbs\Site\Dispatcher; | ||
|
||
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher; | ||
use Joomla\CMS\Helper\HelperFactoryAwareInterface; | ||
use Joomla\CMS\Helper\HelperFactoryAwareTrait; | ||
|
||
// phpcs:disable PSR1.Files.SideEffects | ||
\defined('_JEXEC') or die; | ||
// phpcs:enable PSR1.Files.SideEffects | ||
|
||
/** | ||
* Dispatcher class for mod_breadcrumbs | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface | ||
{ | ||
use HelperFactoryAwareTrait; | ||
|
||
/** | ||
* Returns the layout data. | ||
* | ||
* @return array | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected function getLayoutData(): array | ||
{ | ||
$data = parent::getLayoutData(); | ||
|
||
$data['list'] = $this->getHelperFactory()->getHelper('BreadcrumbsHelper')->getBreadcrumbs($data['params'], $data['app']); | ||
$data['count'] = count($data['list']); | ||
|
||
if (!$data['params']->get('showHome', 1)) { | ||
$data['homeCrumb'] = $this->getHelperFactory()->getHelper('BreadcrumbsHelper')->getHomeItem($data['params'], $data['app']); | ||
} | ||
|
||
return $data; | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
tests/System/integration/site/modules/mod_breadcrumbs/Default.cy.js
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,9 @@ | ||
describe('Test in frondend that the breadcrumbs module', () => { | ||
it('can display the breadcrumb items', () => { | ||
cy.db_createModule({ module: 'mod_breadcrumbs' }).then(() => { | ||
cy.visit('/'); | ||
|
||
cy.contains('li', 'You are here:'); | ||
}); | ||
}); | ||
}); |