/** * This will return an array of shortcodes => labels from the messenger and message_type objects associated with this template. * * @since 4.3.0 * @uses EEH_MSG_Template::get_shortcodes() * * @param string $context what context we're going to return shortcodes for * @param array $fields what fields we're returning valid shortcodes for. If empty then we assume all fields are to be returned. * @param bool $merged If TRUE then we don't return shortcodes indexed by field but instead an array of the unique shortcodes for all the given (or all) fields. * @return mixed (array|bool) an array of shortcodes in the format array( '[shortcode] => 'label') OR FALSE if no shortcodes found. */ public function get_shortcodes($context, $fields = array(), $merged = FALSE) { $messenger = $this->messenger(); $message_type = $this->message_type(); EE_Registry::instance()->load_helper('MSG_Template'); return EEH_MSG_Template::get_shortcodes($message_type, $messenger, $fields, $context, $merged); }
public function newsletter_send_form_skeleton() { $list_table = $this->_list_table_object; $codes = array(); //need to templates for the newsletter message type for the template selector. $values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0); $mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))); foreach ($mtps as $mtp) { $name = $mtp->name(); $values[] = array('text' => empty($name) ? __('Global', 'event_espresso') : $name, 'id' => $mtp->ID()); } //need to get a list of shortcodes that are available for the newsletter message type. $shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE); foreach ($shortcodes as $field => $shortcode_array) { $codes[$field] = implode(', ', array_keys($shortcode_array)); } $shortcodes = $codes; $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php'; $form_template_args = array('form_action' => admin_url('admin.php?page=espresso_registrations'), 'form_route' => 'newsletter_selected_send', 'form_nonce_name' => 'newsletter_selected_send_nonce', 'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'), 'redirect_back_to' => $this->_req_action, 'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'), 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values), 'shortcodes' => $shortcodes, 'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration'); EEH_Template::display_template($form_template, $form_template_args); }
/** * This will return an array of shortcodes => labels from the messenger and message_type objects associated with this template. * * @since 4.3.0 * @uses EEH_MSG_Template::get_shortcodes() * * @param string $context what context we're going to return shortcodes for * @param array $fields what fields we're returning valid shortcodes for. If empty then we assume all fields are to be returned. * @param bool $merged If TRUE then we don't return shortcodes indexed by field but instead an array of the unique shortcodes for all the given (or all) fields. * @return mixed (array|bool) an array of shortcodes in the format array( '[shortcode] => 'label') OR FALSE if no shortcodes found. */ public function get_shortcodes($context, $fields = array(), $merged = FALSE) { $messenger = $this->messenger(); $message_type = $this->message_type(); return EEH_MSG_Template::get_shortcodes($message_type, $messenger, $fields, $context, $merged); }