/** * Render markup for the list field. * * @since 1.5.4 * @param array $lists List data from the API. * @param object $settings Saved module settings. * @return string The markup for the list field. * @access private */ private function render_list_field($lists, $settings) { ob_start(); $options = array('' => __('Choose...', 'fl-builder')); foreach ($lists as $list) { $options[$list['list_id']] = $list['name']; } FLBuilder::render_settings_field('list_id', array('row_class' => 'fl-builder-service-field-row', 'class' => 'fl-builder-service-list-select', 'type' => 'select', 'label' => _x('List', 'An email list from a third party provider.', 'fl-builder'), 'options' => $options, 'preview' => array('type' => 'none')), $settings); return ob_get_clean(); }
foreach (FLBuilderLoop::post_types() as $slug => $type) { ?> <table class="fl-form-table fl-loop-builder-filter fl-loop-builder-<?php echo $slug; ?> -filter" <?php if ($slug == $settings->post_type) { echo 'style="display:table;"'; } ?> > <?php // Posts FLBuilder::render_settings_field('posts_' . $slug, array('type' => 'suggest', 'action' => 'fl_as_posts', 'data' => $slug, 'label' => $type->label, 'help' => sprintf(__('Enter a comma separated list of %s. Only these %s will be shown.', 'fl-builder'), $type->label, $type->label)), $settings); // Taxonomies $taxonomies = FLBuilderLoop::taxonomies($slug); foreach ($taxonomies as $tax_slug => $tax) { FLBuilder::render_settings_field('tax_' . $slug . '_' . $tax_slug, array('type' => 'suggest', 'action' => 'fl_as_terms', 'data' => $tax_slug, 'label' => $tax->label, 'help' => sprintf(__('Enter a comma separated list of %s. Only posts with these %s will be shown.', 'fl-builder'), $tax->label, $tax->label)), $settings); } ?> </table> <?php } ?> <table class="fl-form-table"> <?php // Author FLBuilder::render_settings_field('users', array('type' => 'suggest', 'action' => 'fl_as_users', 'label' => __('Authors', 'fl-builder'), 'help' => __('Enter a comma separated list of authors usernames. Only posts with these authors will be shown.', 'fl-builder')), $settings); ?> </table> </div>
/** * 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(); }
/** * Render markup for the groups field. * * @since 1.6.0 * @param string $list_id The ID of the list for this groups. * @param array $groups An array of group data. * @param object $settings Saved module settings. * @return string The markup for the group field. * @access private */ private function render_groups_field($list_id, $groups, $settings) { if (!is_array($groups) || 0 === count($groups)) { return; } ob_start(); $options = array('' => __('No Group', 'fl-builder')); foreach ($groups as $group) { foreach ($group['groups'] as $subgroup) { $options[$list_id . '_' . $group['id'] . '_' . $subgroup['id']] = $group['name'] . ' - ' . $subgroup['name']; } } FLBuilder::render_settings_field('groups', array('row_class' => 'fl-builder-service-field-row', 'class' => 'fl-builder-mailchimp-group-select', 'type' => 'select', 'label' => _x('Groups', 'MailChimp list group.', 'fl-builder'), 'multi-select' => true, 'options' => $options, 'preview' => array('type' => 'none')), $settings); return ob_get_clean(); }
/** * Render markup for the tag field. * * @since 1.5.8 * @param object $settings Saved module settings. * @return string The markup for the tag field. * @access private */ private function render_tag_field($settings) { ob_start(); FLBuilder::render_settings_field('list_id', array('row_class' => 'fl-builder-service-field-row', 'class' => 'fl-builder-service-list-select', 'type' => 'text', 'label' => _x('Tag', 'A tag to add to contacts in Hatchbuck when they subscribe.', 'fl-builder'), 'preview' => array('type' => 'none')), $settings); return ob_get_clean(); }
/** * Render markup for the tag field. * * @since 1.5.4 * @param object $settings Saved module settings. * @return string The markup for the tag field. * @access private */ private function render_tag_field($settings) { ob_start(); FLBuilder::render_settings_field('list_id', array('row_class' => 'fl-builder-service-field-row', 'class' => 'fl-builder-service-list-select', 'type' => 'text', 'label' => _x('Tags', 'A tag to add to contacts in Drip when they subscribe.', 'fl-builder'), 'help' => __('For multiple tags, separate with comma.', 'fl-builder'), 'preview' => array('type' => 'none')), $settings); return ob_get_clean(); }
<div class="fl-builder-service-settings"> <table class="fl-form-table"> <?php // Get the service type. $service_type = null; if (isset($section['services']) && $section['services'] != 'all') { $service_type = $section['services']; } // Get the service data. $services = FLBuilderServices::get_services_data($service_type); // Remove services that don't meet the requirements. if (isset($services['mailpoet']) && !class_exists('WYSIJA')) { unset($services['mailpoet']); } // Build the select options. $options = array('' => __('Choose...', 'fl-builder')); foreach ($services as $key => $service) { $options[$key] = $service['name']; } // Render the service select. FLBuilder::render_settings_field('service', array('row_class' => 'fl-builder-service-select-row', 'class' => 'fl-builder-service-select', 'type' => 'select', 'label' => __('Service', 'fl-builder'), 'options' => $options, 'preview' => array('type' => 'none')), $settings); ?> </table> </div>
/** * Render markup for the list field. * * @since 1.5.4 * @param array $account_data Saved account data. * @param object $settings Saved module settings. * @return string The markup for the list field. * @access private */ private function render_list_field($account_data, $settings) { $post_data = FLBuilderModel::get_post_data(); // Get the client ID. Return an empty string if we don't have one yet. if (isset($post_data['client'])) { $client_id = $post_data['client']; } else { if (isset($settings->client_id)) { $client_id = $settings->client_id; } else { return ''; } } // Get the list data. $api = new CS_REST_Clients($client_id, $account_data); $lists = $api->get_lists(); // Render the list field. ob_start(); $options = array('' => __('Choose...', 'fl-builder')); foreach ($lists->response as $list) { $options[$list->ListID] = $list->Name; } FLBuilder::render_settings_field('list_id', array('row_class' => 'fl-builder-service-field-row', 'class' => 'fl-builder-service-list-select', 'type' => 'select', 'label' => _x('List', 'An email list from a third party provider.', 'fl-builder'), 'options' => $options, 'preview' => array('type' => 'none')), $settings); return ob_get_clean(); }
// Section Title ?> <h3 class="fl-builder-settings-title"><?php echo $section['title']; ?> </h3> <?php } ?> <table class="fl-form-table"> <?php foreach ($section['fields'] as $name => $field) { // Fields FLBuilder::render_settings_field($name, $field, $settings); } ?> </table> <?php } ?> </div> <?php } ?> <?php }
/** * Render markup for the list field. * * @since 1.5.4 * @param array $lists List data from the API. * @param object $settings Saved module settings. * @return string The markup for the list field. * @access private */ private function render_list_field($groups, $settings) { ob_start(); $options = array('' => __('Choose...', 'fl-builder')); foreach ($groups as $group) { $options[$group['id']] = $group['name']; } FLBuilder::render_settings_field('list_id', array('row_class' => 'fl-builder-service-field-row', 'class' => 'fl-builder-service-list-select', 'type' => 'select', 'multi-select' => true, 'label' => _x('Group', 'A list of subscribers group from a Mailrelay account.', 'fl-builder'), 'options' => $options, 'preview' => array('type' => 'none')), $settings); return ob_get_clean(); }
/** * Renders the markup for the connection settings. * * @since 1.6.0 * @return string The connection settings markup. */ public function render_connect_settings() { ob_start(); FLBuilder::render_settings_field('email', array('row_class' => 'fl-builder-service-connect-row', 'class' => 'fl-builder-service-connect-input', 'type' => 'text', 'label' => __('Email Address', 'fl-builder'), 'preview' => array('type' => 'none'))); return ob_get_clean(); }