function ot_settings_view($name, $key, $setting = array())
 {
     $child = strpos($name, '][settings]') !== false ? true : false;
     $type = isset($setting['type']) ? $setting['type'] : '';
     $std = isset($setting['std']) ? $setting['std'] : '';
     $operator = isset($setting['operator']) ? esc_attr($setting['operator']) : 'and';
     // Serialize the standard value just incase
     if (is_array($std)) {
         $std = maybe_serialize($std);
     }
     if (in_array($type, array('textarea', 'textarea-simple', 'css'))) {
         $std_form_element = '<textarea class="textarea" rows="10" cols="40" name="' . esc_attr($name) . '[' . esc_attr($key) . '][std]">' . esc_html($std) . '</textarea>';
     } else {
         $std_form_element = '<input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][std]" value="' . esc_attr($std) . '" class="widefat option-tree-ui-input" autocomplete="off" />';
     }
     return '
 <div class="option-tree-setting">
   <div class="open">' . (isset($setting['label']) ? esc_attr($setting['label']) : 'Setting ' . ($key + 1)) . '</div>
   <div class="button-section">
     <a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button button left-item" title="' . __('Edit', 'option-tree') . '">
       <span class="icon ot-icon-pencil"></span>' . __('Edit', 'option-tree') . '
     </a>
     <a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button button button-secondary light right-item" title="' . __('Delete', 'option-tree') . '">
       <span class="icon ot-icon-trash-o"></span>' . __('Delete', 'option-tree') . '
     </a>
   </div>
   <div class="option-tree-setting-body">
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>Label</strong>: Displayed as the label of a form element on the Theme Options page.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][label]" value="' . (isset($setting['label']) ? esc_attr($setting['label']) : '') . '" class="widefat option-tree-ui-input option-tree-setting-title" autocomplete="off" />
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>ID</strong>: A unique lower case alphanumeric string, underscores allowed.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][id]" value="' . (isset($setting['id']) ? esc_attr($setting['id']) : '') . '" class="widefat option-tree-ui-input" autocomplete="off" />
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-select wide-desc">
         <div class="description">' . __('<strong>Type</strong>: Choose one of the available option types from the dropdown.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <select name="' . esc_attr($name) . '[' . esc_attr($key) . '][type]" value="' . esc_attr($type) . '" class="option-tree-ui-select">
           ' . ot_loop_through_option_types($type, $child) . '                     
            
           </select>
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-textarea wide-desc">
         <div class="description">' . __('<strong>Description</strong>: Enter a detailed description for the users to read on the Theme Options page, HTML is allowed. This is also where you enter content for both the Textblock & Textblock Titled option types.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <textarea class="textarea" rows="10" cols="40" name="' . esc_attr($name) . '[' . esc_attr($key) . '][desc]">' . (isset($setting['desc']) ? esc_html($setting['desc']) : '') . '</textarea>
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-textblock wide-desc">
         <div class="description">' . __('<strong>Choices</strong>: This will only affect the following option types: Checkbox, Radio, Select & Select Image.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr($name) . '[' . esc_attr($key) . ']">
             ' . (isset($setting['choices']) ? ot_loop_through_choices($name . '[' . $key . ']', $setting['choices']) : '') . '
           </ul>
           <a href="javascript:void(0);" class="option-tree-choice-add option-tree-ui-button button hug-left">' . __('Add Choice', 'option-tree') . '</a>
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-textblock wide-desc">
         <div class="description">' . __('<strong>Settings</strong>: This will only affect the List Item option type.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr($name) . '[' . esc_attr($key) . ']">
             ' . (isset($setting['settings']) ? ot_loop_through_sub_settings($name . '[' . $key . '][settings]', $setting['settings']) : '') . '
           </ul>
           <a href="javascript:void(0);" class="option-tree-list-item-setting-add option-tree-ui-button button hug-left">' . __('Add Setting', 'option-tree') . '</a>
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>Standard</strong>: Setting the standard value for your option only works for some option types. Read the <code>OptionTree->Documentation</code> for more information on which ones.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           ' . $std_form_element . '
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>Rows</strong>: Enter a numeric value for the number of rows in your textarea. This will only affect the following option types: CSS, Textarea, & Textarea Simple.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][rows]" value="' . (isset($setting['rows']) ? esc_attr($setting['rows']) : '') . '" class="widefat option-tree-ui-input" />
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>Post Type</strong>: Add a comma separated list of post type like \'post,page\'. This will only affect the following option types: Custom Post Type Checkbox, & Custom Post Type Select.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][post_type]" value="' . (isset($setting['post_type']) ? esc_attr($setting['post_type']) : '') . '" class="widefat option-tree-ui-input" autocomplete="off" />
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>Taxonomy</strong>: Add a comma separated list of any registered taxonomy like \'category,post_tag\'. This will only affect the following option types: Taxonomy Checkbox, & Taxonomy Select.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][taxonomy]" value="' . (isset($setting['taxonomy']) ? esc_attr($setting['taxonomy']) : '') . '" class="widefat option-tree-ui-input" autocomplete="off" />
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>Min, Max, & Step</strong>: Add a comma separated list of options in the following format <code>0,100,1</code> (slide from <code>0-100</code> in intervals of <code>1</code>). The three values represent the minimum, maximum, and step options and will only affect the Numeric Slider option type.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][min_max_step]" value="' . (isset($setting['min_max_step']) ? esc_attr($setting['min_max_step']) : '') . '" class="widefat option-tree-ui-input" autocomplete="off" />
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>CSS Class</strong>: Add and optional class to this option type.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][class]" value="' . (isset($setting['class']) ? esc_attr($setting['class']) : '') . '" class="widefat option-tree-ui-input" autocomplete="off" />
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . sprintf(__('<strong>Condition</strong>: Add a comma separated list (no spaces) of conditions in which the field will be visible, leave this setting empty to always show the field. In these examples, <code>value</code> is a placeholder for your condition, which can be in the form of %s.', 'option-tree'), '<code>field_id:is(value)</code>, <code>field_id:not(value)</code>, <code>field_id:contains(value)</code>, <code>field_id:less_than(value)</code>, <code>field_id:less_than_or_equal_to(value)</code>, <code>field_id:greater_than(value)</code>, or <code>field_id:greater_than_or_equal_to(value)</code>') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][condition]" value="' . (isset($setting['condition']) ? esc_attr($setting['condition']) : '') . '" class="widefat option-tree-ui-input" autocomplete="off" />
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-select wide-desc">
         <div class="description">' . __('<strong>Operator</strong>: Choose the logical operator to compute the result of the conditions.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <select name="' . esc_attr($name) . '[' . esc_attr($key) . '][operator]" value="' . $operator . '" class="option-tree-ui-select">
             <option value="and" ' . selected($operator, 'and', false) . '>' . __('and', 'option-tree') . '</option>
             <option value="or" ' . selected($operator, 'or', false) . '>' . __('or', 'option-tree') . '</option>
           </select>
         </div>
       </div>
     </div>
   </div>
 </div>
 ' . (!$child ? '<input type="hidden" class="hidden-section" name="' . esc_attr($name) . '[' . esc_attr($key) . '][section]" value="' . (isset($setting['section']) ? esc_attr($setting['section']) : '') . '" />' : '');
 }
 function ot_settings_view($name, $key, $setting = array())
 {
     $child = strpos($name, '][settings]') !== false ? true : false;
     $type = isset($setting['type']) ? $setting['type'] : '';
     $std = isset($setting['std']) ? $setting['std'] : '';
     // Serialize the standard value just incase
     if (is_array($std)) {
         $std = maybe_serialize($std);
     }
     if (in_array($type, array('textarea', 'textarea-simple', 'css'))) {
         $std_form_element = '<textarea class="textarea" rows="10" cols="40" name="' . esc_attr($name) . '[' . esc_attr($key) . '][std]">' . esc_html($std) . '</textarea>';
     } else {
         $std_form_element = '<input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][std]" value="' . esc_attr($std) . '" class="widefat option-tree-ui-input" autocomplete="off" />';
     }
     return '
 <div class="option-tree-setting">
   <div class="open">' . (isset($setting['label']) ? esc_attr($setting['label']) : 'Setting ' . ($key + 1)) . '</div>
   <div class="button-section">
     <a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button left-item" title="' . __('Edit', 'option-tree') . '">
       <span class="icon pencil">' . __('Edit', 'option-tree') . '</span>
     </a>
     <a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button right-item" title="' . __('Delete', 'option-tree') . '">
       <span class="icon trash-can">' . __('Delete', 'option-tree') . '</span>
     </a>
   </div>
   <div class="option-tree-setting-body">
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>Label</strong>: Displayed as the label of a form element on the Theme Options page.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][label]" value="' . (isset($setting['label']) ? esc_attr($setting['label']) : '') . '" class="widefat option-tree-ui-input option-tree-setting-title" autocomplete="off" />
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>ID</strong>: A unique lower case alphanumeric string, underscores allowed.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][id]" value="' . (isset($setting['id']) ? esc_attr($setting['id']) : '') . '" class="widefat option-tree-ui-input" autocomplete="off" />
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-select wide-desc">
         <div class="description">' . __('<strong>Type</strong>: Choose one of the available option types from the dropdown.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <select name="' . esc_attr($name) . '[' . esc_attr($key) . '][type]" value="' . esc_attr($type) . '" class="option-tree-ui-select">
           ' . ot_loop_through_option_types($type, $child) . '                     
            
           </select>
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-textarea wide-desc">
         <div class="description">' . __('<strong>Description</strong>: Enter a detailed description for the users to read on the Theme Options page, HTML is allowed. This is also where you enter content for both the Textblock & Textblock Titled option types.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <textarea class="textarea" rows="10" cols="40" name="' . esc_attr($name) . '[' . esc_attr($key) . '][desc]">' . (isset($setting['desc']) ? esc_html($setting['desc']) : '') . '</textarea>
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-textblock wide-desc">
         <div class="description">' . __('<strong>Choices</strong>: This will only affect the following option types: Checkbox, Radio, Select & Select Image.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr($name) . '[' . esc_attr($key) . ']">
             ' . (isset($setting['choices']) ? ot_loop_through_choices($name . '[' . $key . ']', $setting['choices']) : '') . '
           </ul>
           <a href="javascript:void(0);" class="option-tree-choice-add option-tree-ui-button hug-left">' . __('Add Choice', 'option-tree') . '</a>
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-textblock wide-desc">
         <div class="description">' . __('<strong>Settings</strong>: This will only affect the List Item option type.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr($name) . '[' . esc_attr($key) . ']">
             ' . (isset($setting['settings']) ? ot_loop_through_sub_settings($name . '[' . $key . '][settings]', $setting['settings']) : '') . '
           </ul>
           <a href="javascript:void(0);" class="option-tree-list-item-setting-add option-tree-ui-button hug-left">' . __('Add Setting', 'option-tree') . '</a>
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>Standard</strong>: Setting the standard value for your option only works for some option types. Read the <code>OptionTree->Documentation</code> for more information on which ones.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           ' . $std_form_element . '
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>Rows</strong>: Enter a numeric value for the number of rows in your textarea. This will only affect the following option types: CSS, Textarea, & Textarea Simple.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][rows]" value="' . (isset($setting['rows']) ? esc_attr($setting['rows']) : '') . '" class="widefat option-tree-ui-input" />
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>Post Type</strong>: Add a comma separated list of post type like \'post,page\'. This will only affect the following option types: Custom Post Type Checkbox, & Custom Post Type Select.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][post_type]" value="' . (isset($setting['post_type']) ? esc_attr($setting['post_type']) : '') . '" class="widefat option-tree-ui-input" autocomplete="off" />
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>Taxonomy</strong>: Add a comma separated list of any registered taxonomy like \'category,post_tag\'. This will only affect the following option types: Taxonomy Checkbox, & Taxonomy Select.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][taxonomy]" value="' . (isset($setting['taxonomy']) ? esc_attr($setting['taxonomy']) : '') . '" class="widefat option-tree-ui-input" autocomplete="off" />
         </div>
       </div>
     </div>
     <div class="format-settings">
       <div class="format-setting type-text wide-desc">
         <div class="description">' . __('<strong>CSS Class</strong>: Add and optional class to this option type.', 'option-tree') . '</div>
         <div class="format-setting-inner">
           <input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][class]" value="' . (isset($setting['class']) ? esc_attr($setting['class']) : '') . '" class="widefat option-tree-ui-input" autocomplete="off" />
         </div>
       </div>
     </div>
   </div>
 </div>
 ' . (!$child ? '<input type="hidden" class="hidden-section" name="' . esc_attr($name) . '[' . esc_attr($key) . '][section]" value="' . (isset($setting['section']) ? esc_attr($setting['section']) : '') . '" />' : '');
 }