edit_modules.php
1.49 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* @package Joomla.Administrator
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
$app = JFactory::getApplication();
$form = $displayData->getForm();
$input = $app->input;
$component = $input->getCmd('option', 'com_content');
if ($component == 'com_categories')
{
$extension = $input->getCmd('extension', 'com_content');
$parts = explode('.', $extension);
$component = $parts[0];
}
$saveHistory = JComponentHelper::getParams($component)->get('save_history', 0);
$fields = $displayData->get('fields') ?: array(
array('parent', 'parent_id'),
array('published', 'state', 'enabled'),
array('category', 'catid'),
'featured',
'sticky',
'access',
'language',
'tags',
'note',
'version_note',
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
if (!$saveHistory)
{
$hiddenFields[] = 'version_note';
}
$html = array();
$html[] = '<fieldset class="form-horizontal"><ul class="horizontal-buttons unstyled">';
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
$html[] = '<li>' . $form->renderField($f) . '</li>';
break;
}
}
}
$html[] = '</ul></fieldset>';
echo implode('', $html);