/**
  * This prepares the content of the messenger meta box admin settings
  *
  * @param  EE_messenger $messenger The messenger we're setting up content for
  *
  * @return string            html formatted content
  */
 protected function _get_messenger_box_content(EE_messenger $messenger)
 {
     $fields = $messenger->get_admin_settings_fields();
     $settings_template_args['template_form_fields'] = '';
     //is $messenger active?
     $settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active($messenger->name);
     if (!empty($fields)) {
         $existing_settings = $messenger->get_existing_admin_settings();
         foreach ($fields as $fldname => $fldprops) {
             $field_id = $messenger->name . '-' . $fldname;
             $template_form_field[$field_id] = array('name' => 'messenger_settings[' . $field_id . ']', 'label' => $fldprops['label'], 'input' => $fldprops['field_type'], 'type' => $fldprops['value_type'], 'required' => $fldprops['required'], 'validation' => $fldprops['validation'], 'value' => isset($existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'], 'css_class' => '', 'format' => $fldprops['format']);
         }
         $settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') : '';
     }
     //we also need some hidden fields
     $settings_template_args['hidden_fields'] = array('messenger_settings[messenger]' => array('type' => 'hidden', 'value' => $messenger->name), 'type' => array('type' => 'hidden', 'value' => 'messenger'));
     //make sure any active message types that are existing are included in the hidden fields
     if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) {
         foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) {
             $settings_template_args['hidden_fields']['messenger_settings[message_types][' . $mt . ']'] = array('type' => 'hidden', 'value' => $mt);
         }
     }
     $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
     $active = $this->_message_resource_manager->is_messenger_active($messenger->name);
     $settings_template_args['messenger'] = $messenger->name;
     $settings_template_args['description'] = $messenger->description;
     $settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';
     $settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active($messenger->name) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
     $settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
     $settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';
     $settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce');
     $settings_template_args['on_off_status'] = $active ? true : false;
     $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';
     $content = EEH_Template::display_template($template, $settings_template_args, true);
     return $content;
 }