32
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-12-26 01:57:30 +00:00

Use namespace class + remove un-used code

This commit is contained in:
Tuan Pham Ngoc 2021-06-20 16:33:55 +07:00
parent 17fbda865c
commit 908870576f

View File

@ -13,6 +13,7 @@ defined('_JEXEC') or die;
use Joomla\CMS\Factory; use Joomla\CMS\Factory;
use Joomla\CMS\Helper\ContentHelper; use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException; use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\Toolbar;
@ -79,8 +80,6 @@ class HtmlView extends BaseHtmlView
if (count($errors = $this->get('Errors'))) if (count($errors = $this->get('Errors')))
{ {
throw new GenericDataException(implode("\n", $errors), 500); throw new GenericDataException(implode("\n", $errors), 500);
return false;
} }
// We don't need toolbar in the modal layout. // We don't need toolbar in the modal layout.
@ -124,7 +123,7 @@ class HtmlView extends BaseHtmlView
// Get the toolbar object instance // Get the toolbar object instance
$toolbar = Toolbar::getInstance('toolbar'); $toolbar = Toolbar::getInstance('toolbar');
ToolbarHelper::title(\JText::_('COM_WEBLINKS_MANAGER_WEBLINKS'), 'link weblinks'); ToolbarHelper::title(Text::_('COM_WEBLINKS_MANAGER_WEBLINKS'), 'link weblinks');
if ($canDo->get('core.create') || \count($user->getAuthorisedCategories('com_weblinks', 'core.create')) > 0) if ($canDo->get('core.create') || \count($user->getAuthorisedCategories('com_weblinks', 'core.create')) > 0)
{ {
@ -185,24 +184,4 @@ class HtmlView extends BaseHtmlView
ToolbarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS'); ToolbarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS');
} }
/**
* Returns an array of fields the table can be sorted by
*
* @return array Array containing the field name to sort by as the key and display text as value
*
* @since 3.0
*/
protected function getSortFields()
{
return array(
'a.ordering' => \JText::_('JGRID_HEADING_ORDERING'),
'a.state' => \JText::_('JSTATUS'),
'a.title' => \JText::_('JGLOBAL_TITLE'),
'a.access' => \JText::_('JGRID_HEADING_ACCESS'),
'a.hits' => \JText::_('JGLOBAL_HITS'),
'a.language' => \JText::_('JGRID_HEADING_LANGUAGE'),
'a.id' => \JText::_('JGRID_HEADING_ID'),
);
}
} }