Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function (Toolbar $childBar) use ($checkedOut, $canDo, $user, $isNew) {
} else {
$toolbar->cancel('banner.cancel');

if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $canDo->get('core.edit')) {
$toolbar->versions('com_banners.banner', $this->item->id);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function (Toolbar $childBar) use ($checkedOut, $canDo, $isNew) {
} else {
$toolbar->cancel('client.cancel');

if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $canDo->get('core.edit')) {
$toolbar->versions('com_banners.client', $this->item->id);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo, $user) {

$toolbar->cancel('contact.cancel');

if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $itemEditable) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $itemEditable) {
$toolbar->versions('com_contact.contact', $this->item->id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo, $user) {
$toolbar->cancel('article.cancel', 'JTOOLBAR_CLOSE');

if (!$isNew) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $itemEditable) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $itemEditable) {
$toolbar->versions('com_content.article', $this->item->id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected function addToolbar(): Toolbar

// Clean up input to ensure a clean url.
$filter = InputFilter::getInstance();
$aliasArray = explode('.', $this->state->item_id);
$aliasArray = explode('.', $this->state->get('item_id'));

if ($aliasArray[1] === 'category') {
$option = 'com_categories';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ abstract class FieldsPlugin extends CMSPlugin
*
* @var \Joomla\CMS\Application\CMSApplication
* @since 4.0.0
*
* @deprecated __DEPLOY_VERSION__ will be removed in 7.0 use $this->getApplication() instead
*/
protected $app;

Expand Down Expand Up @@ -138,6 +140,7 @@ public function onCustomFieldsGetTypes()
return $types_cache[$this->_type . $this->_name];
}

$app = $this->getApplication() ?: $this->app;
$types = [];

// The root of the plugin
Expand All @@ -160,11 +163,11 @@ public function onCustomFieldsGetTypes()
// Needed attributes
$data['type'] = $layout;

if ($this->app->getLanguage()->hasKey('PLG_FIELDS_' . $key . '_LABEL')) {
if ($app->getLanguage()->hasKey('PLG_FIELDS_' . $key . '_LABEL')) {
$data['label'] = Text::sprintf('PLG_FIELDS_' . $key . '_LABEL', strtolower($key));

// Fix wrongly set parentheses in RTL languages
if ($this->app->getLanguage()->isRtl()) {
if ($app->getLanguage()->isRtl()) {
$data['label'] .= '‎';
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function display($tpl = null)
$this->state = $model->getState();
$this->filterForm = $model->getFilterForm();
$this->activeFilters = $model->getActiveFilters();
$this->enabled = $this->state->params->get('gather_search_statistics', 0);
$this->enabled = $this->state->get('params')->get('gather_search_statistics', 0);
$this->canDo = ContentHelper::getActions('com_finder');
$uri = Uri::getInstance();
$link = 'index.php?option=com_config&view=component&component=com_finder&return=' . base64_encode($uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function (Toolbar $childBar) use ($checkedOut, $canDo, $user, $isNew) {
} else {
$toolbar->cancel('newsfeed.cancel');

if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $canDo->get('core.edit')) {
$toolbar->versions('com_newsfeeds.newsfeed', $this->item->id);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo) {

$toolbar->cancel('tag.cancel');

if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $itemEditable) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $itemEditable) {
$toolbar->versions('com_tags.tag', $this->item->id);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function (Toolbar $childBar) use ($checkedOut, $canDo, $user, $isNew) {
} else {
$toolbar->cancel('note.cancel');

if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $canDo->get('core.edit')) {
$toolbar->versions('com_users.note', $this->item->id);
}
}
Expand Down
2 changes: 2 additions & 0 deletions administrator/language/en-GB/com_content.ini
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ COM_CONTENT_FIELD_URLS_OPTIONS="URL Options"
COM_CONTENT_FIELD_URLSPOSITION_LABEL="Positioning of the Links"
COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS="Use Article Settings"
COM_CONTENT_FIELD_VERSION_LABEL="Revision"
COM_CONTENT_FIELD_YEAR_SORT_DESC="The order in which years will appear in the year sort dropdown. Oldest First shows years in ascending order (2011, 2012...). Most Recent First shows years in descending order (2025, 2024...)."
COM_CONTENT_FIELD_YEAR_SORT_LABEL="Year Sort Order"
COM_CONTENT_FIELDS_ARTICLE_FIELD_ADD_TITLE="Articles: New Field"
COM_CONTENT_FIELDS_ARTICLE_FIELD_EDIT_TITLE="Articles: Edit Field"
COM_CONTENT_FIELDS_ARTICLE_FIELDS_TITLE="Articles: Fields"
Expand Down
3 changes: 3 additions & 0 deletions administrator/language/en-GB/com_users.ini
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ COM_USERS_FIELD_LOGOUT_REDIRECTMENU_LABEL="Menu Item Logout Redirect"
COM_USERS_FIELD_LOGOUT_REDIRECT_CHOICE_DESC="'Internal URL' lets you manually enter any internal URL in the Redirect field. 'Menu Item' lets you directly select an existing menu item.<br>For a multilingual site, it is recommended to use 'Menu Item'."
COM_USERS_FIELD_LOGOUT_REDIRECT_CHOICE_LABEL="Choose Logout Redirect Type"
COM_USERS_FIELD_LOGOUT_REDIRECT_ERROR="Only one of the logout redirect fields should have a value."
COM_USERS_FIELD_REGISTRATION_DESC="Set a Menu Item to utilize a custom registration page."
COM_USERS_FIELD_REGISTRATION_LABEL="Registration Page"
COM_USERS_FIELD_NOTEBODY_LABEL="Note"
COM_USERS_FIELD_OPTIONS_LOGIN="Login"
COM_USERS_FIELD_OPTIONS_LOGOUT="Logout"
COM_USERS_FIELD_OPTIONS_REGISTRATION="Registration"
COM_USERS_FIELD_REVIEW_TIME_LABEL="Review Date"
COM_USERS_FIELD_SUBJECT_LABEL="Subject"
COM_USERS_FIELD_USER_ID_LABEL="User"
Expand Down
5 changes: 4 additions & 1 deletion administrator/modules/mod_menu/src/Dispatcher/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
namespace Joomla\Module\Menu\Administrator\Dispatcher;

use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
use Joomla\CMS\Factory;
use Joomla\Database\DatabaseInterface;
use Joomla\Module\Menu\Administrator\Menu\CssMenu;

// phpcs:disable PSR1.Files.SideEffects
Expand All @@ -33,11 +35,12 @@ class Dispatcher extends AbstractModuleDispatcher
*/
protected function getLayoutData()
{
$db = Factory::getContainer()->get(DatabaseInterface::class);
$data = parent::getLayoutData();

$data['enabled'] = !$data['app']->getInput()->getBool('hidemainmenu');

$data['menu'] = new CssMenu($data['app']);
$data['menu'] = new CssMenu($data['app'], $db);
$data['root'] = $data['menu']->load($data['params'], $data['enabled']);
$data['root']->level = 0;

Expand Down
26 changes: 22 additions & 4 deletions administrator/modules/mod_menu/src/Menu/CssMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Event\Menu\PreprocessMenuItemsEvent;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Associations;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Menu\AdministratorMenuItem;
use Joomla\CMS\Uri\Uri;
use Joomla\Component\Menus\Administrator\Helper\MenusHelper;
use Joomla\Database\DatabaseAwareInterface;
use Joomla\Database\DatabaseAwareTrait;
use Joomla\Database\DatabaseInterface;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;

Expand All @@ -30,8 +34,10 @@
*
* @since 1.5
*/
class CssMenu
class CssMenu implements DatabaseAwareInterface
{
use DatabaseAwareTrait;

/**
* The root of the menu
*
Expand Down Expand Up @@ -89,12 +95,24 @@ class CssMenu
/**
* CssMenu constructor.
*
* @param CMSApplication $application The application
* @param CMSApplication $application The application
* @param ?DatabaseInterface $db The database
*
* @since 4.0.0
*/
public function __construct(CMSApplication $application)
public function __construct(CMSApplication $application, ?DatabaseInterface $db = null)
{
if ($db === null) {
@trigger_error(
__CLASS__ . ': The $db parameter must be set for the constructor.',
\E_USER_DEPRECATED
);

$db = Factory::getContainer()->get(DatabaseInterface::class);
}

$this->setDatabase($db);

$this->application = $application;
$this->root = new AdministratorMenuItem();
}
Expand Down Expand Up @@ -230,7 +248,7 @@ protected function check($node, Registry $params)
$uri = clone Uri::getInstance();
$uri->setVar('recover_menu', 1);

$table = $this->application->bootComponent('com_menu')->getMVCFactory()->createTable('MenuType');
$table = new \Joomla\CMS\Table\MenuType($this->getDatabase());
$menutype = $params->get('menutype');

$table->load(['menutype' => $menutype]);
Expand Down
40 changes: 0 additions & 40 deletions administrator/modules/mod_submenu/mod_submenu.php

This file was deleted.

2 changes: 1 addition & 1 deletion administrator/modules/mod_submenu/mod_submenu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<description>MOD_SUBMENU_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Module\Submenu</namespace>
<files>
<filename module="mod_submenu">mod_submenu.php</filename>
<folder module="mod_submenu">services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
Expand Down
39 changes: 39 additions & 0 deletions administrator/modules/mod_submenu/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage mod_submenu
*
* @copyright (C) 2025 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 administrator dashboard menu 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\\Submenu'));

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

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

namespace Joomla\Module\Submenu\Administrator\Dispatcher;

use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
use Joomla\Component\Menus\Administrator\Helper\MenusHelper;
use Joomla\Module\Submenu\Administrator\Menu\Menu;

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

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

$menutype = $data['params']->get('menutype', '*');
$data['root'] = false;

if ($menutype === '*') {
$name = $data['params']->get('preset', 'system');
$data['root'] = MenusHelper::loadPreset($name);
} else {
$data['root'] = MenusHelper::getMenuItems($menutype, true);
}

if ($data['root'] && $data['root']->hasChildren()) {
$data['app']->getLanguage()->load(
'mod_menu',
JPATH_ADMINISTRATOR,
$data['app']->getLanguage()->getTag(),
true
);

Menu::preprocess($data['root']);
}

return $data;
}
}
2 changes: 1 addition & 1 deletion administrator/modules/mod_submenu/src/Menu/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static function preprocess($parent)
$app = Factory::getApplication();
$user = $app->getIdentity();
$children = $parent->getChildren();
$language = Factory::getLanguage();
$language = $app->getLanguage();
$dispatcher = $app->getDispatcher();

/**
Expand Down
Loading
Loading