Skip to content

Commit

Permalink
Merge branch '5.1-dev' into 5.1/modules/site/feed
Browse files Browse the repository at this point in the history
  • Loading branch information
LadySolveig committed Feb 27, 2024
2 parents 31ee28d + ff55280 commit 135ec22
Show file tree
Hide file tree
Showing 36 changed files with 1,041 additions and 171 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Table\Table;
use Joomla\Component\Guidedtours\Administrator\Helper\GuidedtoursHelper;

Expand Down Expand Up @@ -232,7 +231,7 @@ protected function loadFormData()
*
* @param integer $pk The id of the primary key.
*
* @return CMSObject|boolean Object on success, false on failure.
* @return \stdClass|boolean Object on success, false on failure.
*
* @since 4.3.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ protected function loadFormData()
*
* @param integer|string $pk The id or uid of the tour.
*
* @return CMSObject|boolean Object on success, false on failure.
* @return \stdClass|boolean Object on success, false on failure.
*
* @since 4.3.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected function loadFormData()
*
* @param integer $pk The id of the primary key.
*
* @return CMSObject|boolean Object on success, false on failure.
* @return \stdClass|boolean Object on success, false on failure.
*
* @since 4.0.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function getForm($data = [], $loadData = true)
*
* @param integer $pk The id of the primary key.
*
* @return CMSObject|boolean Object on success, false on failure.
* @return \stdClass|boolean Object on success, false on failure.
*
* @since 4.0.0
*/
Expand Down Expand Up @@ -195,7 +195,7 @@ public function getItem($pk = null)
*
* @param integer $pk The id of the primary key.
*
* @return CMSObject|boolean Object on success, false on failure.
* @return \stdClass|boolean Object on success, false on failure.
*
* @since 4.0.0
*/
Expand Down
29 changes: 22 additions & 7 deletions administrator/components/com_templates/tmpl/style/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,33 @@ class="form-validate">

<?php
$this->fieldsets = [];
$this->ignore_fieldsets = ['basic', 'description'];
$this->ignore_fieldsets = ['basic', 'description', 'assigned'];
echo LayoutHelper::render('joomla.edit.params', $this);
?>

<?php if ($user->authorise('core.edit', 'com_menus') && $this->item->client_id == 0 && $this->canDo->get('core.edit.state')) : ?>
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'assignment', Text::_('COM_TEMPLATES_MENUS_ASSIGNMENT')); ?>
<fieldset id="fieldset-assignment" class="options-form">
<legend><?php echo Text::_('COM_TEMPLATES_MENUS_ASSIGNMENT'); ?></legend>
<div>
<?php echo $this->loadTemplate('assignment'); ?>
</div>
</fieldset>
<?php if ($this->form->getGroup('assigned')) : ?>
<?php
$this->ignore_fieldsets = ['basic'];
$this->fieldset = 'assigned';

foreach ($this->form->getFieldsets() as $fieldSet) {
if ($fieldSet->name !== 'assigned') {
$this->ignore_fieldsets[] = $fieldSet->name;
}
}

echo LayoutHelper::render('joomla.edit.fieldset', $this);
?>
<?php else : ?>
<fieldset id="fieldset-assignment" class="options-form">
<legend><?php echo Text::_('COM_TEMPLATES_MENUS_ASSIGNMENT'); ?></legend>
<div>
<?php echo $this->loadTemplate('assignment'); ?>
</div>
</fieldset>
<?php endif; ?>
<?php echo HTMLHelper::_('uitab.endTab'); ?>
<?php endif; ?>

Expand Down
25 changes: 0 additions & 25 deletions administrator/modules/mod_custom/mod_custom.php

This file was deleted.

4 changes: 3 additions & 1 deletion administrator/modules/mod_custom/mod_custom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>MOD_CUSTOM_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Module\Custom</namespace>

<customContent />

<files>
<filename module="mod_custom">mod_custom.php</filename>
<folder module="mod_custom">services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<languages>
Expand Down
39 changes: 39 additions & 0 deletions administrator/modules/mod_custom/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage mod_custom
*
* @copyright (C) 2024 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\Module;
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;

/**
* The custom 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)
{
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Custom'));

$container->registerServiceProvider(new Module());
}
};
49 changes: 49 additions & 0 deletions administrator/modules/mod_custom/src/Dispatcher/Dispatcher.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage mod_custom
*
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Module\Custom\Administrator\Dispatcher;

use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Plugin\PluginHelper;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* Dispatcher class for mod_custom
*
* @since __DEPLOY_VERSION__
*/
class Dispatcher extends AbstractModuleDispatcher
{
/**
* Returns the layout data.
*
* @return array
*
* @since __DEPLOY_VERSION__
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();

if ($data['params']->def('prepare_content', 1)) {
PluginHelper::importPlugin('content');
$this->module->content = HTMLHelper::_('content.prepare', $this->module->content, '', 'mod_custom.content');
}

// Replace 'images/' to '../images/' when using an image from /images in backend.
$this->module->content = preg_replace('*src\=\"(?!administrator\/)images/*', 'src="../images/', $this->module->content);

return $data;
}
}
36 changes: 0 additions & 36 deletions administrator/modules/mod_messages/mod_messages.php

This file was deleted.

4 changes: 3 additions & 1 deletion administrator/modules/mod_messages/mod_messages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
<authorUrl>www.joomla.org</authorUrl>
<version>4.0.0</version>
<description>MOD_MESSAGES_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Module\Messages</namespace>
<files>
<filename module="mod_messages">mod_messages.php</filename>
<folder module="mod_messages">services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<languages>
Expand Down
43 changes: 43 additions & 0 deletions administrator/modules/mod_messages/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage mod_messages
*
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

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;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* The messages 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)
{
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Messages'));
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Messages\\Administrator\\Helper'));

$container->registerServiceProvider(new Module());
}
};
65 changes: 65 additions & 0 deletions administrator/modules/mod_messages/src/Dispatcher/Dispatcher.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage mod_messages
*
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Module\Messages\Administrator\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_messages
*
* @since __DEPLOY_VERSION__
*/
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
{
use HelperFactoryAwareTrait;

/**
* Runs the dispatcher.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function dispatch()
{
// Check permissions.
if (
!$this->getApplication()->getIdentity()->authorise('core.login.admin')
|| !$this->getApplication()->getIdentity()->authorise('core.manage', 'com_messages')
) {
return;
}

parent::dispatch();
}

/**
* Returns the layout data.
*
* @return array
*
* @since __DEPLOY_VERSION__
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();

$data['countUnread'] = $this->getHelperFactory()->getHelper('MessagesHelper')->getUnreadMessagesCount($data['params'], $this->getApplication());

return $data;
}
}

0 comments on commit 135ec22

Please sign in to comment.