}
array_unshift($lists,array('label'=>'Select a List', 'value'=>''));
+ if(!empty($lists)){
+ $listArray = array(
+ 'label' => 'Lists',
+ 'type' => 'select',
+ 'name' => 'lists',
+ 'tooltip' => 'Select a list to add the contact',
+ 'choices' => $lists
+ );
+ } else {
+ $listArray = array(
+ 'label' => 'Lists',
+ 'type' => 'text',
+ 'name' => 'noLists',
+ 'value' => 'No lists detected'
+ );
+ }
+ ?>
+ <script type="text/javascript">
+ document.addEventListener("DOMContentLoaded", function(event) {
+ var list = document.getElementById('noLists');
+ list.style.background = "none";
+ list.readOnly = true;
+ list.style.border = "none";
+ list.style.color = "red";
+ list.style.boxShadow = "none";
+ });
+ </script>
+ <?php
return array(
array(
'title' => 'StreamSend Form Settings',
'tooltip' => esc_html__( 'Just a name', 'StreamSend' ),
'class' => 'small',
),
- array(
- 'label' => 'Lists',
- 'type' => 'select',
- 'name' => 'lists',
- 'tooltip' => 'Select a list to add the contact',
- 'choices' => $lists
-
- ),
+ $listArray,
array(
'label' => 'Enable Opt-In',
'type' => 'checkbox',