mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
formField() evals allow_empty
This commit is contained in:
parent
245092bb10
commit
13a0646698
|
@ -1138,17 +1138,21 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
||||||
} elseif(is_array($value)) {
|
} elseif(is_array($value)) {
|
||||||
switch($value['element']) {
|
switch($value['element']) {
|
||||||
case 'select':
|
case 'select':
|
||||||
|
$allowempty = empty($value['allow_empty']) ? false : $value['allow_empty'];
|
||||||
echo '<select'.
|
echo '<select'.
|
||||||
(!empty($value['id']) ? ' id="'.$value['id'].'"' : '').
|
(!empty($value['id']) ? ' id="'.$value['id'].'"' : '').
|
||||||
(!empty($value['name']) ? ' name="'.$value['name'].'"' : '').
|
(!empty($value['name']) ? ' name="'.$value['name'].'"' : '').
|
||||||
(!empty($value['class']) ? ' class="'.$value['class'].'"' : '').
|
(!empty($value['class']) ? ' class="'.$value['class'].'"' : '').
|
||||||
(!empty($value['placeholder']) ? ' data-placeholder="'.$value['placeholder'].'"' : '').
|
(!empty($value['placeholder']) ? ' data-placeholder="'.$value['placeholder'].'"' : '').
|
||||||
|
($allowempty ? ' data-allow-clear="true"' : '').
|
||||||
(!empty($value['multiple']) ? ' multiple' : '');
|
(!empty($value['multiple']) ? ' multiple' : '');
|
||||||
if(!empty($value['attributes']) && is_array($value['attributes']))
|
if(!empty($value['attributes']) && is_array($value['attributes']))
|
||||||
foreach($value['attributes'] as $a)
|
foreach($value['attributes'] as $a)
|
||||||
echo ' '.$a[0].'="'.$a[1].'"';
|
echo ' '.$a[0].'="'.$a[1].'"';
|
||||||
echo ">";
|
echo ">";
|
||||||
if(isset($value['options']) && is_array($value['options'])) {
|
if(isset($value['options']) && is_array($value['options'])) {
|
||||||
|
if($allowempty)
|
||||||
|
echo "<option value=\"\"></option>";
|
||||||
foreach($value['options'] as $val) {
|
foreach($value['options'] as $val) {
|
||||||
if(is_string($val)) {
|
if(is_string($val)) {
|
||||||
echo '<optgroup label="'.$val.'">';
|
echo '<optgroup label="'.$val.'">';
|
||||||
|
|
|
@ -1122,17 +1122,21 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
||||||
} elseif(is_array($value)) {
|
} elseif(is_array($value)) {
|
||||||
switch($value['element']) {
|
switch($value['element']) {
|
||||||
case 'select':
|
case 'select':
|
||||||
|
$allowempty = empty($value['allow_empty']) ? false : $value['allow_empty'];
|
||||||
echo '<select'.
|
echo '<select'.
|
||||||
(!empty($value['id']) ? ' id="'.$value['id'].'"' : '').
|
(!empty($value['id']) ? ' id="'.$value['id'].'"' : '').
|
||||||
(!empty($value['name']) ? ' name="'.$value['name'].'"' : '').
|
(!empty($value['name']) ? ' name="'.$value['name'].'"' : '').
|
||||||
(empty($value['class']) ? ' class="form-control"' : ' class="form-control '.$value['class'].'"').
|
(empty($value['class']) ? ' class="form-control"' : ' class="form-control '.$value['class'].'"').
|
||||||
(!empty($value['placeholder']) ? ' data-placeholder="'.$value['placeholder'].'"' : '').
|
(!empty($value['placeholder']) ? ' data-placeholder="'.$value['placeholder'].'"' : '').
|
||||||
|
($allowempty ? ' data-allow-clear="true"' : '').
|
||||||
(!empty($value['multiple']) ? ' multiple' : '');
|
(!empty($value['multiple']) ? ' multiple' : '');
|
||||||
if(!empty($value['attributes']) && is_array($value['attributes']))
|
if(!empty($value['attributes']) && is_array($value['attributes']))
|
||||||
foreach($value['attributes'] as $a)
|
foreach($value['attributes'] as $a)
|
||||||
echo ' '.$a[0].'="'.$a[1].'"';
|
echo ' '.$a[0].'="'.$a[1].'"';
|
||||||
echo ">";
|
echo ">";
|
||||||
if(isset($value['options']) && is_array($value['options'])) {
|
if(isset($value['options']) && is_array($value['options'])) {
|
||||||
|
if($allowempty)
|
||||||
|
echo "<option value=\"\"></option>";
|
||||||
foreach($value['options'] as $val) {
|
foreach($value['options'] as $val) {
|
||||||
if(is_string($val)) {
|
if(is_string($val)) {
|
||||||
echo '<optgroup label="'.$val.'">';
|
echo '<optgroup label="'.$val.'">';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user