Skip to content

[4.0] com_banners blank state #1687

@jgerman-bot

Description

@jgerman-bot

New language relevant PR in upstream repo: joomla/joomla-cms#33269 Here are the upstream changes:

Click to expand the diff!
diff --git a/administrator/components/com_banners/src/View/Banners/HtmlView.php b/administrator/components/com_banners/src/View/Banners/HtmlView.php
index 4782e9d39e69..3a4c6418d4cd 100644
--- a/administrator/components/com_banners/src/View/Banners/HtmlView.php
+++ b/administrator/components/com_banners/src/View/Banners/HtmlView.php
@@ -101,6 +101,11 @@ public function display($tpl = null): void
 		$this->filterForm    = $model->getFilterForm();
 		$this->activeFilters = $model->getActiveFilters();
 
+		if (!count($this->items) && $this->get('IsBlankSlate'))
+		{
+			$this->setLayout('blankstate');
+		}
+
 		// Check for errors.
 		if (count($errors = $this->get('Errors')))
 		{
diff --git a/administrator/components/com_banners/tmpl/banners/blankstate.php b/administrator/components/com_banners/tmpl/banners/blankstate.php
new file mode 100644
index 000000000000..c8dd6f81726d
--- /dev/null
+++ b/administrator/components/com_banners/tmpl/banners/blankstate.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * @package     Joomla.Administrator
+ * @subpackage  com_banners
+ *
+ * @copyright   (C) 2021 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_banners&view=banners'); ?>" method="post" name="adminForm" id="adminForm">
+
+	<div class="px-4 py-5 my-5 text-center">
+		<span class="fa-8x icon-bookmark banners mb-4" aria-hidden="true"></span>
+		<h1 class="display-5 fw-bold"><?php echo Text::_('COM_BANNERS_BLANKSTATE_TITLE'); ?></h1>
+		<div class="col-lg-6 mx-auto">
+			<p class="lead mb-4">
+				<?php echo Text::_('COM_BANNERS_BLANKSTATE_CONTACT'); ?>
+			</p>
+			<div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
+				<a href="<?php echo Route::_('index.php?option=com_banners&view=banner&layout=edit'); ?>" class="btn btn-primary btn-lg px-4 me-sm-3"><?php echo Text::_('COM_BANNERS_BLANKSTATE_BUTTON_ADD'); ?></a>
+				<a href="https://docs.joomla.org/Special:MyLanguage/Help40:Banners" class="btn btn-outline-secondary btn-lg px-4"><?php echo Text::_('COM_BANNERS_BLANKSTATE_BUTTON_LEARNMORE'); ?></a>
+			</div>
+		</div>
+	</div>
+
+	<input type="hidden" name="task" value="">
+	<input type="hidden" name="boxchecked" value="0">
+</form>
diff --git a/administrator/language/en-GB/com_banners.ini b/administrator/language/en-GB/com_banners.ini
index 6bdf18f9464b..0d39eea8fe4c 100644
--- a/administrator/language/en-GB/com_banners.ini
+++ b/administrator/language/en-GB/com_banners.ini
@@ -34,6 +34,10 @@ COM_BANNERS_BATCH_OPTIONS="Batch process the selected banners"
 COM_BANNERS_BATCH_TIP="If a category is selected for move/copy, any actions selected will be applied to the copied or moved banners. Otherwise, all actions are applied to the selected banners."
 COM_BANNERS_BEGIN_HINT="Begin date (yyyy-mm-dd)"
 COM_BANNERS_BEGIN_LABEL="Begin Date"
+COM_BANNERS_BLANKSTATE_BUTTON_ADD="Add your first banner"
+COM_BANNERS_BLANKSTATE_BUTTON_LEARNMORE="Learn more"
+COM_BANNERS_BLANKSTATE_CONTACT="Banners are blocks of content containing advertising information and a record of the number of times the banner has been displayed is kept. You can use this component to create and manage your banners."
+COM_BANNERS_BLANKSTATE_TITLE="No Banners have been created yet."
 COM_BANNERS_CANCEL="Cancel"
 COM_BANNERS_CLICK="Click"
 COM_BANNERS_CLIENT_EDIT="Edit Client"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions