-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.php
48 lines (35 loc) · 1.25 KB
/
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
45
46
47
48
<?php
/**
* @package Joomla Contact Form Module
*
* @author ETD Solutions (@etd-framework)
* version 1.0.0
* @copyright Copyright (C) 2017 ETD Solutions. All rights reserved.
* @license Apache License version 2 or later; see LICENSE.md
*/
// No direct access
defined('_JEXEC') or die;
class ModContactHelper {
public static function getContact($id) {
$model = self::getContactModel();
$model->setState('contact.id', $id);
return $model->getItem($id);
}
public static function getContactForm() {
$model = self::getContactModel();
return $model->getForm();
}
public static function getContactModel() {
static $model;
if (!isset($model)) {
JModelLegacy::addIncludePath(JPATH_ROOT . "/components/com_contact/models");
JForm::addFormPath(JPATH_ROOT . "/components/com_contact/models/forms");
JForm::addFieldPath(JPATH_ROOT . "/components/com_contact/models/fields");
$model = JModelLegacy::getInstance('Contact', 'ContactModel', array(
'ignore_request' => true
));
$model->setState('params', JComponentHelper::getParams('com_contact'));
}
return $model;
}
}