Files
MokoSuiteBackup/source/packages/com_mokosuitebackup/src/View/Profiles/HtmlView.php
T
jmiller a808789acb
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 23s
feat: add COM_MOKOJOOMBACKUP_SHORT and apply short name to views and admin menu
- Add COM_MOKOJOOMBACKUP_SHORT="Backup" to the component .ini and .sys.ini
  (en-GB + en-US) so both view titles and the admin sidebar menu resolve it.
- Prefix every admin view's toolbar title with the short brand via the
  constant (e.g. "Backup: Dashboard", "Backup: Records"), and tighten the
  view title strings that redundantly led with "Backup"/"MokoSuiteBackup".
- Admin sidebar top-level menu now shows the short name. Hardcoded as
  "Backup" in the manifest per the package-xml convention (no language
  strings in package XML).
2026-07-04 14:20:54 -05:00

75 lines
2.2 KiB
PHP

<?php
/**
* @package MokoSuiteBackup
* @subpackage com_mokosuitebackup
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
*/
namespace Joomla\Component\MokoSuiteBackup\Administrator\View\Profiles;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\MokoSuiteBackup\Administrator\Engine\AkeebaImporter;
class HtmlView extends BaseHtmlView
{
protected $items;
protected $pagination;
protected $state;
public $filterForm;
public $activeFilters = [];
public bool $akeebaDetected = false;
public function display($tpl = null): void
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check if Akeeba Backup is installed
$importer = new AkeebaImporter();
$detection = $importer->detect();
$this->akeebaDetected = $detection['profiles'];
$this->addToolbar();
parent::display($tpl);
}
protected function addToolbar(): void
{
$user = Factory::getApplication()->getIdentity();
ToolbarHelper::title(Text::_('COM_MOKOJOOMBACKUP_SHORT') . ': ' . Text::_('COM_MOKOJOOMBACKUP_PROFILES_TITLE'), 'cog');
if ($user->authorise('core.create', 'com_mokosuitebackup')) {
ToolbarHelper::addNew('profile.add');
}
if ($user->authorise('core.edit', 'com_mokosuitebackup')) {
ToolbarHelper::editList('profile.edit');
}
if ($this->akeebaDetected && $user->authorise('core.create', 'com_mokosuitebackup')) {
ToolbarHelper::custom('profiles.importAkeeba', 'upload', '', 'COM_MOKOJOOMBACKUP_TOOLBAR_IMPORT_AKEEBA', false);
}
if ($user->authorise('core.delete', 'com_mokosuitebackup')) {
ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'profiles.delete');
}
if ($user->authorise('core.admin', 'com_mokosuitebackup')) {
ToolbarHelper::preferences('com_mokosuitebackup');
}
}
}