コード例 #1
0
 /**
  * Formats array for drop down in terms of Visual Composer.
  *
  * @since  0.3.0
  * @access private
  * @param  string
  *
  * @return array
  */
 private function get_values($param)
 {
     $return = array();
     $items = array();
     $defined_options = $this->helper->get_option_group();
     if ($this->client->has_valid_api_key() && $defined_options['list_id']) {
         if ('list' == $param) {
             $group = new Api\Cleverreach_Group_Adapter($this->client);
             $items = $this->helper->parse_list($group->get_list(), 'list_id');
         } elseif ('form' == $param) {
             $form = new Api\Cleverreach_Form_Adapter($this->client);
             $items = $this->helper->parse_list($form->get_list($defined_options['list_id']), 'form_id', true);
         }
         // Prepare drop down lists in terms of Visual Composer.
         foreach ($items as $item) {
             $return[$item['name']] = $item['id'];
         }
     }
     return $return;
 }
コード例 #2
0
 /**
  * Render list input field and description.
  *
  * @since 0.1.0
  */
 public function render_list_field()
 {
     $html = '<select class="cre-admin-select-list" name="cleverreach_extension[list_id]">';
     $client = new Api\Cleverreach();
     $helper = new Core\Cre_Helper();
     if ($client->has_valid_api_key()) {
         $group = new Api\Cleverreach_Group_Adapter($client);
         $html .= $helper->parse_list_html($this->list_id, $group->get_list(), 'list_id', esc_html__('Please select a list', 'cleverreachextension'));
     }
     $html .= '</select>';
     echo wp_kses($html, $helper->allowed_html_select());
 }
コード例 #3
0
 /**
  * Render list input field and description.
  *
  * @since 0.1.0
  */
 public function render_list_field()
 {
     $html = '<select class="cre-admin-select-list" name="cleverreach_extension[list_id]">';
     $client = new Api\Cleverreach();
     $helper = new Core\Cre_Helper();
     $default = esc_html__('Please select a list', 'cleverreach-extension');
     if ($client->has_valid_api_key()) {
         $group = new Api\Cleverreach_Group_Adapter($client);
         $html .= $helper->parse_list_html($this->list_id, $group->get_list(), 'list_id', $default);
     } else {
         $html .= '<option value="">' . $default . '</option>';
     }
     $html .= '</select>';
     echo '<div class="cre-input-container">';
     echo wp_kses($html, $helper->allowed_html_select());
     printf('<div class="dashicons-before cre-info-message %s cre-js-response"></div>', $client->has_valid_api_key() && $helper->has_option('list_id') ? 'confirmed' : 'invalid');
     echo '</div>';
 }