| 1 |
<?php defined( 'ABSPATH' ) or die; |
| 2 |
/* @var PixCustomifyFormField $field */ |
| 3 |
/* @var PixCustomifyForm $form */ |
| 4 |
/* @var mixed $default */ |
| 5 |
/* @var string $name */ |
| 6 |
/* @var string $idname */ |
| 7 |
/* @var string $label */ |
| 8 |
/* @var string $desc */ |
| 9 |
/* @var string $rendering */ |
| 10 |
|
| 11 |
// [!!] the counter field needs to be able to work inside other fields; if |
| 12 |
// the field is in another field it will have a null label |
| 13 |
|
| 14 |
$selected = $form->autovalue( $name, $default ); |
| 15 |
|
| 16 |
$attrs = array |
| 17 |
( |
| 18 |
'name' => $name, |
| 19 |
'id' => $idname, |
| 20 |
); |
| 21 |
|
| 22 |
// group show |
| 23 |
|
| 24 |
if ($field->hasmeta('show_group')) { |
| 25 |
$attrs['data-show_group'] = $field->getmeta('show_group'); |
| 26 |
} |
| 27 |
|
| 28 |
if ($field->hasmeta('display_option')) { |
| 29 |
$attrs['data-display_option'] = $field->getmeta('display_option'); |
| 30 |
}?> |
| 31 |
<div class="select"> |
| 32 |
<label id="<?php echo $name ?>"><?php echo $label ?></label> |
| 33 |
<select <?php echo $field->htmlattributes( $attrs ) ?>> |
| 34 |
<?php foreach ( $this->getmeta( 'options', array() ) as $key => $label ): ?> |
| 35 |
<option <?php if ($key == $selected): ?>selected<?php endif; ?> |
| 36 |
value="<?php echo $key ?>"> |
| 37 |
<?php echo $label ?> |
| 38 |
</option> |
| 39 |
<?php endforeach; ?> |
| 40 |
</select> |
| 41 |
</div> |
| 42 |
|