-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.php
44 lines (37 loc) · 970 Bytes
/
helper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* @package Module.Admin
* @subpackage mod_article
*
* @copyright Copyright (C) 2020 Thomas Hunziker.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_content/models', 'ContentModel');
/**
* Helper for mod_article
*
* @since 1.0.0
*/
abstract class ModArticleHelper
{
/**
* Get a list of articles.
*
* @param \Joomla\Registry\Registry &$params The module parameters.
*
* @return object|false An article object, or false on error.
*/
public static function getItem(&$params)
{
// Get an instance of the generic articles model
$model = JModelLegacy::getInstance('Article', 'ContentModel', array('ignore_request' => true));
$item = $model->getItem($params->get('id'));
if ($error = $model->getError())
{
JError::raiseError(500, $error);
return false;
}
return $item;
}
}