/**
  * Get the saved data for a specific account.
  *
  * @since 1.5.4
  * @param string $account The account name.
  * @return array|bool The account data or false if it doesn't exist.
  */
 public function get_account_data($account)
 {
     $saved_services = FLBuilderModel::get_services();
     if (isset($saved_services[$this->id]) && isset($saved_services[$this->id][$account])) {
         return $saved_services[$this->id][$account];
     }
     return false;
 }
 /**
  * Render the account settings for a saved connection.
  *
  * @since 1.5.4
  * @param string $service The service id such as "mailchimp".
  * @param string $active The name of the active account, if any.
  * @return string The account settings markup.
  */
 public static function render_account_settings($service, $active = '')
 {
     ob_start();
     $saved_services = FLBuilderModel::get_services();
     $settings = new stdClass();
     $settings->service_account = $active;
     $options = array('' => __('Choose...', 'fl-builder'));
     // Build the account select options.
     foreach ($saved_services[$service] as $account => $data) {
         $options[$account] = $account;
     }
     $options['add_new_account'] = __('Add Account...', 'fl-builder');
     // Render the account select.
     FLBuilder::render_settings_field('service_account', array('row_class' => 'fl-builder-service-account-row', 'class' => 'fl-builder-service-account-select', 'type' => 'select', 'label' => __('Account', 'fl-builder'), 'options' => $options, 'preview' => array('type' => 'none')), $settings);
     // Render additional service fields if we have a saved account.
     if (!empty($active) && isset($saved_services[$service][$active])) {
         $post_data = FLBuilderModel::get_post_data();
         $module = FLBuilderModel::get_module($post_data['node_id']);
         $instance = self::get_service_instance($service);
         $response = $instance->render_fields($active, $module->settings);
         if (!$response['error']) {
             echo $response['html'];
         }
     }
     return ob_get_clean();
 }