/**
  * Field Template Assignment Tab Archives.
  * 
  * @since 1.0.0
  * @access public
  * @param string $field_name Field name.
  * @param array $selected Selected value.
  * @return string
  */
 private static function print_archive_tabs($field_name, $selected = array())
 {
     $output = '<div id="visibility-tabs-archive" class="visibility-tabs ui-tabs visibility-tabs-' . $field_name . ' visibility-tabs-' . $field_name . '-archive"><ul class="clearfix">';
     $taxonomies = apply_filters('tf_hooks_visibility_taxonomies', get_taxonomies(array('public' => true)));
     $exclude_tax = array('post_format', 'product_shipping_class');
     // Exclude unnecessary taxonomies
     foreach ($exclude_tax as $tax) {
         if (isset($taxonomies[$tax])) {
             unset($taxonomies[$tax]);
         }
     }
     $taxonomies = array_map('get_taxonomy', $taxonomies);
     /* build the tab links */
     foreach ($taxonomies as $key => $tax) {
         $output .= '<li><a href="#visibility-tab-archive-' . $key . '">' . $tax->labels->name . '</a></li>';
     }
     $output .= '<li><a href="#visibility-tab-archive-archives">' . __('Archives', 'themify-flow') . '</a></li>';
     $output .= '<li><a href="#visibility-tab-archive-taxonomies">' . __('Taxonomies', 'themify-flow') . '</a></li>';
     $output .= '</ul>';
     foreach ($taxonomies as $key => $tax) {
         $output .= '<div id="visibility-tab-archive-' . $key . '" class="themify-visibility-options clearfix">';
         $categories = get_terms($key, array('hide_empty' => true));
         $output .= wp_kses_post(sprintf(__('<p><small>Check which %s where the template will be used for the %s views.</small></p>', 'themify-flow'), $tax->labels->name, $tax->labels->singular_name));
         $checked = isset($selected['archive'][$key]['all']) ? checked($selected['archive'][$key]['all'], 'on', false) : '';
         $output .= '<label class="label-full"><input class="tf_toggle_prop" type="checkbox" name="' . $field_name . '[archive][' . $key . '][all]" ' . $checked . ' />' . __('Apply to all', 'themify-flow') . '</label>';
         if (count($categories) > 0) {
             foreach ($categories as $term) {
                 $checked = isset($selected['archive'][$key][$term->slug]) ? checked($selected['archive'][$key][$term->slug], 'on', false) : '';
                 $output .= '<label><input type="checkbox" name="' . $field_name . '[archive][' . $key . '][' . $term->slug . ']" ' . $checked . ' />' . $term->name . '</label>';
             }
         }
         $output .= '</div>';
         // tab-archives
     }
     // Archives tab
     $output .= '<div id="visibility-tab-archive-archives" class="themify-visibility-options clearfix">';
     $archives = array('is_search' => __('Search', 'themify-flow'), 'is_date' => __('Date', 'themify-flow'), 'is_author' => __('Author', 'themify-flow'), 'is_year' => __('Year', 'themify-flow'), 'is_day' => __('Day', 'themify-flow'), 'is_month' => __('Month', 'themify-flow'), 'is_home' => __('Latest Posts Homepage', 'themify-flow'));
     $output .= wp_kses_post(__('<p><small>Check which archive views where the template will be used. Note: if "Apply to all" is checked, it will apply to the archive views of all other custom post types as well.</small></p>', 'themify-flow'));
     $checked = isset($selected['archive']['archive']['all']) ? checked($selected['archive']['archive']['all'], 'on', false) : '';
     $output .= '<label class="label-full"><input class="tf_toggle_prop" type="checkbox" name="' . $field_name . '[archive][archive][all]" ' . $checked . ' />' . __('Apply to all', 'themify-flow') . '</label>';
     foreach ($archives as $key => $label) {
         $checked = isset($selected['archive']['archive'][$key]) ? checked($selected['archive']['archive'][$key], 'on', false) : '';
         $output .= '<label><input type="checkbox" name="' . $field_name . '[archive][archive][' . $key . ']" ' . $checked . ' />' . $label . '</label>';
     }
     $post_types = apply_filters('tf_hooks_visibility_post_types', get_post_types(array('public' => true)));
     unset($post_types['page']);
     $post_types = array_map('get_post_type_object', $post_types);
     foreach ($post_types as $key => $post_type) {
         $checked = isset($selected['archive']['archive']['post_type'][$key]) ? checked($selected['archive']['archive']['post_type'][$key], 'on', false) : '';
         $output .= '<label><input type="checkbox" name="' . $field_name . '[archive][archive][post_type][' . $key . ']" ' . $checked . ' />' . esc_html($post_type->label) . '</label>';
     }
     $output .= '</div>';
     // tab-archive-archives
     // Taxonomies tab
     $output .= '<div id="visibility-tab-archive-taxonomies" class="themify-visibility-options clearfix">';
     $taxonomies = TF_Model::get_taxonomies(array(), array('category', 'post_tag'));
     $output .= wp_kses_post(__('<p><small>Check which taxonomy archive views where the template will be used. Note: if "Apply to all" is checked, it will apply to the archive views of all other custom taxonomies as well.</small></p>', 'themify-flow'));
     $checked = isset($selected['archive']['tax']['all']) ? checked($selected['archive']['tax']['all'], 'on', false) : '';
     $output .= '<label class="label-full"><input class="tf_toggle_prop" type="checkbox" name="' . $field_name . '[archive][tax][all]" ' . $checked . ' />' . __('Apply to all', 'themify-flow') . '</label>';
     if (count($taxonomies) > 0) {
         foreach ($taxonomies as $key => $tax) {
             $checked = isset($selected['archive']['tax'][$key]) ? checked($selected['archive']['tax'][$key], 'on', false) : '';
             $output .= '<label><input type="checkbox" name="' . $field_name . '[archive][tax][' . $key . ']" ' . $checked . ' />' . $tax->label . '</label>';
         }
     }
     $output .= '</div>';
     // tab-archive-taxonomies
     $output .= '</div>';
     return $output;
 }