/**
  * Render Template Regions metabox.
  * 
  * @since 1.0.0
  * @access public
  * @param object $post 
  */
 public function render_template_regions($post)
 {
     // Add an nonce field so we can check for it later.
     wp_nonce_field('tf_template_option_custom_box', 'tf_template_option_custom_box_nonce');
     $fields = array('template_part_caption' => array('type' => 'separator', 'meta' => array('html' => sprintf(__('<h4>Select a <a href="%s">Template Part</a> for each region: Header, Sidebar, and Footer.</h4>', 'themify-flow'), admin_url('edit.php?post_type=tf_template_part')))), 'tf_template_region_header' => array('type' => 'template_part_select', 'label' => __('Header', 'themify-flow'), 'show_extra_link' => false), 'tf_template_region_sidebar' => array('type' => 'template_part_select', 'label' => __('Sidebar', 'themify-flow'), 'show_extra_link' => false), 'tf_template_region_footer' => array('type' => 'template_part_select', 'label' => __('Footer', 'themify-flow'), 'show_extra_link' => false));
     $data = TF_Model::get_field_exist_values($fields, $post->ID);
     /* not used anymore
     		if ( count( $data ) > 0 ) {
     			foreach( $data as $key => $shortcode ) {
     				preg_match('/.*slug="(.*)"/i', $shortcode, $slug );
     				$data[ $key ] = isset( $slug[1] ) ? $slug[1] : '';
     			}
     		}*/
     echo '<div class="tf_interface">';
     echo TF_Form::render($fields, $data);
     echo '</div>';
 }
 /**
  * Render duplicate form options in Lightbox via Hooks
  * 
  * @since 1.0.0
  * @access public
  */
 public function render_duplicate_form()
 {
     $theme_id = (int) $_POST['postid'];
     $theme = get_post($theme_id);
     $data = get_post_meta($theme_id, 'theme_info', true);
     $data['tf_theme_name'] = $theme->post_title . ' Copy';
     $fields = $this->fields();
     if (isset($fields['tf_import_base_template_and_part'])) {
         unset($fields['tf_import_base_template_and_part']);
     }
     echo TF_Form::open(array('id' => 'tf_theme_duplicate_form'));
     wp_nonce_field('tf_theme_export_nonce', 'nonce_field');
     echo sprintf('<input type="hidden" name="_theme_id" value="%d">', $theme_id);
     echo TF_Form::render($fields, $data);
     echo TF_Form::submit_button(__('Duplicate', 'themify-flow'));
     echo TF_Form::close();
 }
 /**
  * Render Template Options metabox.
  * 
  * @since 1.0.0
  * @access public
  * @param object $post 
  */
 public function render_template_part_option($post)
 {
     // Add an nonce field so we can check for it later.
     wp_nonce_field('tf_template_part_option_custom_box', 'tf_template_part_option_custom_box_nonce');
     $fields = $this->fields();
     unset($fields['tf_template_part_name']);
     $data = TF_Model::get_field_exist_values($fields, $post->ID);
     echo '<div class="tf_interface">';
     echo TF_Form::render($fields, $data);
     echo '</div>';
 }
 /**
  * Fires to render row option form.
  * 
  * @since 1.0.0
  * @access public
  * @param string $method Form state method (add|edit|delete)
  */
 public function render_row_option_form($method)
 {
     $label_submit_btn = 'add' == $method ? __('Add', 'themify-flow') : __('Update', 'themify-flow');
     $data = array();
     $shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : '';
     $atts = isset($_POST['shortcode_params']) ? $_POST['shortcode_params'] : array();
     $shortcode_id = isset($atts['sc_id']) ? $atts['sc_id'] : TF_Model::generate_block_id();
     $template_id = isset($_POST['template_id']) ? $_POST['template_id'] : 0;
     $mode = isset($_POST['mode']) ? $_POST['mode'] : 'frontend';
     // proses data here
     if ('edit' == $method) {
         $data = stripslashes_deep($atts);
     }
     echo TF_Form::open(array('id' => 'tf_row_option_form'));
     echo sprintf('<input type="hidden" name="_state" value="%s">', $method);
     echo sprintf('<input type="hidden" name="_shortcode_name" value="%s">', $shortcode);
     echo sprintf('<input type="hidden" name="_template_id" value="%d">', $template_id);
     echo sprintf('<input type="hidden" name="sc_id" value="%s">', $shortcode_id);
     echo sprintf('<input type="hidden" name="_mode" value="%s">', $mode);
     echo TF_Form::render(TF_Shortcodes::row_fields(), $data);
     echo TF_Form::submit_button($label_submit_btn);
     echo TF_Form::close();
 }