public static function sender_submission_fields(SI_Estimate $estimate) { $fields = array(); $from_name = SI_Notifications_Control::from_name(array('estimate_id' => $estimate->get_id())); $from_email = SI_Notifications_Control::from_email(array('estimate_id' => $estimate->get_id())); $fields['send_as'] = array('weight' => 1, 'label' => self::__('Sender'), 'type' => 'text', 'placeholder' => '', 'attributes' => array('readonly' => 'readonly'), 'default' => $from_name . ' <' . $from_email . '>'); // options for recipients $client = $estimate->get_client(); $recipient_options = '<div class="form-group"><div class="input_wrap">'; // client users if (is_a($client, 'SI_Client')) { $client_users = $client->get_associated_users(); foreach ($client_users as $user_id) { $recipient_options .= sprintf('<label class="clearfix"><input type="checkbox" name="sa_metabox_recipients[]" value="%1$s"> %2$s</label>', $user_id, esc_attr(SI_Notifications::get_user_email($user_id))); } } $recipient_options .= sprintf('<label class="clearfix"><input type="checkbox" name="sa_metabox_custom_recipient_check" disabled="disabled"><input type="text" name="sa_metabox_custom_recipient" placeholder="%1$s"><span class="helptip" title="%2$s"></span></label>', self::__('*****@*****.**'), self::__('Entering an email will prevent some notification shortcodes from working since there is no client.')); // Send to me. $recipient_options .= sprintf('<label class="clearfix"><input type="checkbox" name="sa_metabox_recipients[]" value="%1$s"> %2$s</label>', get_current_user_id(), si__('Send me a copy')); $recipient_options .= '</div></div>'; $fields['recipients'] = array('weight' => 5, 'label' => sprintf('%s <span class="helptip" title="%s"></span>', si__('Recipients'), si__('A notification will be sent if recipients are selected and this estimate is saved.')), 'type' => 'bypass', 'output' => $recipient_options); $fields['sender_note'] = array('weight' => 10, 'label' => self::__('Note'), 'type' => 'textarea', 'default' => $estimate->get_sender_note(), 'description' => si__('This note will be added to the Estimate Notification via the [admin_note] shortcode.')); $fields['doc_id'] = array('type' => 'hidden', 'value' => $estimate->get_id(), 'weight' => 10000); $fields['notification_nonce'] = array('type' => 'hidden', 'value' => wp_create_nonce(SI_Controller::NONCE), 'weight' => 10001); $fields = apply_filters('si_sender_submission_fields', $fields); uasort($fields, array(__CLASS__, 'sort_by_weight')); return $fields; }