Skip to content

Commit 62e9189

Browse files
authored
Merge branch '6.0-dev' into 6.0-dev/remove-bs-fw
2 parents be9d260 + f390731 commit 62e9189

File tree

23 files changed

+94
-1066
lines changed

23 files changed

+94
-1066
lines changed

administrator/components/com_admin/sql/updates/mysql/6.0.0-2024-06-01.sql

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- Update link to featured
2+
3+
UPDATE `#__menu`
4+
SET `link` = 'index.php?option=com_content&view=articles&filter[featured]=1'
5+
WHERE `link` = 'index.php?option=com_content&view=featured'
6+
AND `client_id` = 1;

administrator/components/com_admin/sql/updates/postgresql/6.0.0-2024-06-01.sql

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- Update link to featured
2+
3+
UPDATE "#__menu"
4+
SET "link" = 'index.php?option=com_content&view=articles&filter[featured]=1'
5+
WHERE "link" = 'index.php?option=com_content&view=featured'
6+
AND "client_id" = 1;

administrator/components/com_content/forms/filter_articles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
name="featured"
1515
type="list"
1616
label="JFEATURED"
17+
filtermode="selector"
1718
class="js-select-submit-on-change"
18-
default=""
1919
validate="options"
2020
>
2121
<option value="">COM_CONTENT_SELECT_FEATURED</option>

administrator/components/com_content/forms/filter_featured.xml

Lines changed: 0 additions & 152 deletions
This file was deleted.

administrator/components/com_content/presets/content.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
title="COM_CONTENT_MENUS_FEATURED"
3333
type="component"
3434
element="com_content"
35-
link="index.php?option=com_content&amp;view=featured"
35+
link="index.php?option=com_content&amp;view=articles&amp;filter[featured]=1"
3636
class="class:featured"
3737
/>
3838
</menuitem>

administrator/components/com_content/src/Controller/ArticlesController.php

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
1717
use Joomla\CMS\Response\JsonResponse;
1818
use Joomla\CMS\Router\Route;
19+
use Joomla\Component\Content\Administrator\Model\ArticlesModel;
1920
use Joomla\Input\Input;
2021
use Joomla\Utilities\ArrayHelper;
2122

@@ -145,9 +146,7 @@ public function getQuickiconContent()
145146
{
146147
$model = $this->getModel('articles');
147148

148-
$model->setState('filter.published', 1);
149-
150-
$amount = (int) $model->getTotal();
149+
$amount = (int) $model->getTotal($featured = '');
151150

152151
$result = [];
153152

@@ -157,4 +156,31 @@ public function getQuickiconContent()
157156

158157
echo new JsonResponse($result);
159158
}
159+
160+
/**
161+
* Method to get the number of published featured articles for quickicons
162+
*
163+
* @return void
164+
*
165+
* @since __DEPLOY_VERSION__
166+
*/
167+
public function getQuickiconFeatured()
168+
{
169+
/**
170+
* @var ArticlesModel $model
171+
*/
172+
$model = $this->getModel('articles');
173+
174+
$model->setState('filter.featured', '1');
175+
176+
$amount = (int) $model->getTotal();
177+
178+
$result = [];
179+
180+
$result['amount'] = $amount;
181+
$result['sronly'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON_SRONLY', $amount);
182+
$result['name'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON', $amount);
183+
184+
echo new JsonResponse($result);
185+
}
160186
}

administrator/components/com_content/src/Controller/DisplayController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ public function display($cachable = false, $urlparams = [])
6262
return false;
6363
}
6464

65+
if ($view === 'featured' || $this->input->getInt('featured')) {
66+
$this->setRedirect(Route::_('index.php?option=com_content&view=articles&filter[featured]=1', false));
67+
return false;
68+
}
69+
6570
return parent::display();
6671
}
6772
}

administrator/components/com_content/src/Controller/FeaturedController.php

Lines changed: 6 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
*
77
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
88
* @license GNU General Public License version 2 or later; see LICENSE.txt
9+
*
10+
* @deprecated 6.0 will be removed in 8.0
911
*/
1012

1113
namespace Joomla\Component\Content\Administrator\Controller;
1214

13-
use Joomla\CMS\Language\Text;
14-
use Joomla\CMS\Response\JsonResponse;
15-
1615
// phpcs:disable PSR1.Files.SideEffects
1716
\defined('_JEXEC') or die;
1817
// phpcs:enable PSR1.Files.SideEffects
@@ -21,107 +20,11 @@
2120
* Featured content controller class.
2221
*
2322
* @since 1.6
23+
*
24+
* @deprecated 6.0 will be removed in 8.0
25+
* Use \Joomla\Component\Content\Administrator\Controller\ArticlesController instead
26+
* For Quickicons use articles.getQuickiconFeatured()
2427
*/
2528
class FeaturedController extends ArticlesController
2629
{
27-
/**
28-
* Removes an item.
29-
*
30-
* @return void
31-
*
32-
* @since 1.6
33-
*/
34-
public function delete()
35-
{
36-
// Check for request forgeries
37-
$this->checkToken();
38-
39-
$user = $this->app->getIdentity();
40-
$ids = (array) $this->input->get('cid', [], 'int');
41-
42-
// Access checks.
43-
foreach ($ids as $i => $id) {
44-
// Remove zero value resulting from input filter
45-
if ($id === 0) {
46-
unset($ids[$i]);
47-
48-
continue;
49-
}
50-
51-
if (!$user->authorise('core.delete', 'com_content.article.' . (int) $id)) {
52-
// Prune items that you can't delete.
53-
unset($ids[$i]);
54-
$this->app->enqueueMessage(Text::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'notice');
55-
}
56-
}
57-
58-
if (empty($ids)) {
59-
$this->app->enqueueMessage(Text::_('JERROR_NO_ITEMS_SELECTED'), 'error');
60-
} else {
61-
/** @var \Joomla\Component\Content\Administrator\Model\FeatureModel $model */
62-
$model = $this->getModel();
63-
64-
// Remove the items.
65-
if (!$model->featured($ids, 0)) {
66-
$this->app->enqueueMessage($model->getError(), 'error');
67-
}
68-
}
69-
70-
$this->setRedirect('index.php?option=com_content&view=featured');
71-
}
72-
73-
/**
74-
* Method to publish a list of articles.
75-
*
76-
* @return void
77-
*
78-
* @since 1.0
79-
*/
80-
public function publish()
81-
{
82-
parent::publish();
83-
84-
$this->setRedirect('index.php?option=com_content&view=featured');
85-
}
86-
87-
/**
88-
* Method to get a model object, loading it if required.
89-
*
90-
* @param string $name The model name. Optional.
91-
* @param string $prefix The class prefix. Optional.
92-
* @param array $config Configuration array for model. Optional.
93-
*
94-
* @return \Joomla\CMS\MVC\Model\BaseDatabaseModel The model.
95-
*
96-
* @since 1.6
97-
*/
98-
public function getModel($name = 'Feature', $prefix = 'Administrator', $config = ['ignore_request' => true])
99-
{
100-
return parent::getModel($name, $prefix, $config);
101-
}
102-
103-
/**
104-
* Method to get the number of published featured articles for quickicons
105-
*
106-
* @return void
107-
*
108-
* @since 4.3.0
109-
*/
110-
public function getQuickiconContent()
111-
{
112-
$model = $this->getModel('articles');
113-
114-
$model->setState('filter.published', 1);
115-
$model->setState('filter.featured', 1);
116-
117-
$amount = (int) $model->getTotal();
118-
119-
$result = [];
120-
121-
$result['amount'] = $amount;
122-
$result['sronly'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON_SRONLY', $amount);
123-
$result['name'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON', $amount);
124-
125-
echo new JsonResponse($result);
126-
}
12730
}

0 commit comments

Comments
 (0)