Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class HtmlView extends BaseHtmlView
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->isBlankState = count($this->items) ? false : $this->get('IsBlankSlate');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
Expand Down
34 changes: 34 additions & 0 deletions administrator/components/com_content/tmpl/articles/blankstate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_content
*
* @copyright (C) 2008 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\Language\Text;
use Joomla\CMS\Router\Route;

?>
<form action="<?php echo Route::_('index.php?option=com_content&view=articles'); ?>" method="post" name="adminForm" id="adminForm">

<div class="px-4 py-5 my-5 text-center">
<span aria-hidden="true" class="fa-8x icon-copy mb-4 article"></span>
<h1 class="display-5 fw-bold"><?php echo Text::_('COM_CONTENT_BLANKSTATE_TITLE'); ?></h1>
<div class="col-lg-6 mx-auto">
<p class="lead mb-4">
<?php echo Text::_('COM_CONTENT_BLANKSTATE_CONTENT'); ?>
</p>
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
<a href="<?php echo Route::_('index.php?option=com_content&view=article&layout=edit'); ?>" class="btn btn-primary btn-lg px-4 me-sm-3"><?php echo Text::_('COM_CONTENT_BLANKSTATE_BUTTON_ADD'); ?></a>
<a href="https://docs.joomla.org/Adding_a_new_article" class="btn btn-outline-secondary btn-lg px-4"><?php echo Text::_('COM_CONTENT_BLANKSTATE_BUTTON_LEARNMORE'); ?></a>
</div>
</div>
</div>

<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
use Joomla\Component\Content\Administrator\Helper\ContentHelper;
use Joomla\Utilities\ArrayHelper;

if ($this->isBlankState === true)
{
require 'blankstate.php';

return;
}

HTMLHelper::_('behavior.multiselect');

// Just for the tests :(
Expand Down
4 changes: 4 additions & 0 deletions administrator/language/en-GB/com_content.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ COM_CONTENT_ATTRIBS_ARTICLE_SETTINGS_LABEL="Options"
COM_CONTENT_ATTRIBS_FIELDSET_LABEL="Options"
COM_CONTENT_BATCH_OPTIONS="Batch process the selected articles"
COM_CONTENT_BATCH_TIP="If a category is selected for move/copy, any actions selected will be applied to the copied or moved articles. Otherwise, all actions are applied to the selected articles."
COM_CONTENT_BLANKSTATE_BUTTON_ADD="Add your first article"
COM_CONTENT_BLANKSTATE_BUTTON_LEARNMORE="Learn more"
COM_CONTENT_BLANKSTATE_CONTENT="Articles are the main content on most Joomla sites. You can use the Joomla Article Editor to create and manage your content."
COM_CONTENT_BLANKSTATE_TITLE="Looks like you don't have any Articles yet"
COM_CONTENT_CHANGE_STAGE="Change stage"
COM_CONTENT_CHANGE_STAGE_AMBIGUOUS_TRANSITIONS="Some transitions are ambiguous for this condition. Please select your preferred transition and proceed."
COM_CONTENT_CONFIG_ARTICLE_SETTINGS_DESC="These settings apply for article layouts unless they are changed for a specific menu item or article."
Expand Down
24 changes: 24 additions & 0 deletions libraries/src/MVC/Model/ListModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\Pagination\Pagination;
use Joomla\Database\DatabaseQuery;
use Joomla\Database\Mysqli\MysqliQuery;

/**
* Model class for handling lists of items.
Expand Down Expand Up @@ -149,6 +150,29 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu
}
}

/**
* Is this a blank state, I.e: no items of this type regardless of the searched for states.
*
* @return boolean
*
* @since __DEPLOY_VERSION__
*/
public function getisBlankSlate()
{
/** @var MysqliQuery $sql */
$sql = $this->query
->clear('select')
->clear('values')
->clear('bounded')
->clear('where')
->select('count(*)')
->setLimit(1);

$this->_db->setQuery($sql);

return (bool) (1 - $this->_db->loadResult());
}

/**
* Method to cache the last query constructed.
*
Expand Down