forked from gruz/GJFields
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.php
More file actions
67 lines (60 loc) · 1.42 KB
/
Copy pathlist.php
File metadata and controls
67 lines (60 loc) · 1.42 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
<?php
/**
* @package GJFileds
*
* @copyright 0000 Copyright (C) All rights reversed.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL or later
*/
JFormHelper::loadFieldClass('list');
defined('JPATH_PLATFORM') or die;
/**
* This field replaces original list field because the original one doesn't
* allow to have multiple lists with several default values
*
* @package Joomla.Platform
* @subpackage Form
* @since 11.1
*/
class GJFieldsFormFieldList extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 11.1
*/
protected $type = 'GJList';
/**
* Method to get the field input markup for a generic list.
* Use the multiple attribute to enable multiselect.
*
* @return string The field input markup.
*
* @since 11.1
*/
protected function getInput()
{
if (!empty($this->element['placeholder']))
{
$this->class = $this->element['class'] . '" data-placeholder="' . JText::_($this->element['placeholder']) . '"';
}
// This is a fix to allow multiple default values
if ($this->multiple && !empty($this->value) && !is_array($this->value))
{
$this->value = array_map('trim', explode(",", $this->value));
}
return parent::getInput();
}
}
// Preserve compatibility
if (!class_exists('JFormFieldGJList'))
{
/**
* Old-fashioned field name
*
* @since 1.2.0
*/
class JFormFieldGJList extends GJFieldsFormFieldList
{
}
}