| @@ -13,34 +13,18 @@ | ||
| 13 | 13 | <div class="meta-fields"> |
| 14 | 14 | <div class="general-fields"> |
| 15 | 15 | <div> |
| 16 | 16 | <?php |
| 17 | - $main_triggers = self::get_notification_triggers(); | |
| 18 | - foreach ($main_triggers as $key => $triggers) { | |
| 19 | - $dropdown_triggers[$key] = wp_list_pluck($triggers, 'label', 'id'); | |
| 20 | - } | |
| 21 | - $selected_trigger = Notifier_Notification_Triggers::get_post_trigger_id($post_id); | |
| 17 | + notifier_wp_select( | |
| 18 | + array( | |
| 19 | + 'id' => NOTIFIER_PREFIX . 'trigger', | |
| 20 | + 'value' => get_post_meta( $post_id, NOTIFIER_PREFIX . 'trigger', true), | |
| 21 | + 'label' => 'Select Trigger', | |
| 22 | + 'description' => 'Select the trigger when you want to fire a Natification from WANotifier.com.', | |
| 23 | + 'options' => Notifier_Notification_Triggers::get_notification_triggers_dropdown() | |
| 24 | + ) | |
| 25 | + ); | |
| 22 | 26 | ?> |
| 23 | - <p class="form-field mb-3 notifier_trigger_field " data-conditions=""> | |
| 24 | - <label for="notifier_trigger" class="form-label">Select Trigger</label> | |
| 25 | - <select class="form-select" style="" name="notifier_trigger" id="notifier_trigger"> | |
| 26 | - <option value="">Select trigger</option> | |
| 27 | - <?php | |
| 28 | - foreach ($main_triggers as $key => $triggers) { | |
| 29 | - if(empty($triggers)){ | |
| 30 | - continue; | |
| 31 | - } | |
| 32 | - echo '<optgroup label="'.esc_attr($key).'">'; | |
| 33 | - foreach($triggers as $trigger){ | |
| 34 | - $selected = selected( $selected_trigger, $trigger['id'], false); | |
| 35 | - echo '<option value="'.esc_attr($trigger['id']).'" title="'.esc_attr($trigger['description']).'" '.$selected.' >'.esc_attr($trigger['label']).'</option>'; | |
| 36 | - } | |
| 37 | - echo '</optgroup>'; | |
| 38 | - } | |
| 39 | - ?> | |
| 40 | - </select> | |
| 41 | - <span class="description">Select the trigger when you want to fire the Notification on WANotifier.com.</span> | |
| 42 | - </p> | |
| 43 | 27 | </div> |
| 44 | 28 | <?php |
| 45 | 29 | $send_to_conditions = array ( |
| 46 | 30 | array ( |