function video_cell_dialog_template_callback()
    {
        ob_start();
        ?>

		<div class="ddl-form">
			<p>
				<label for="<?php 
        the_ddl_name_attr('video_url');
        ?>
"><?php 
        _e('Video URL', 'ddl-layouts');
        ?>
:</label>
				<input type="text" name="<?php 
        the_ddl_name_attr('video_url');
        ?>
">
				<span class="desc"><?php 
        _e('eg. https://www.youtube.com/watch?v=vHkRZ-70SRs', 'ddl-layouts');
        ?>
</span>
                <div class="js-video-message" id="js-video-message"></div>
			</p>
			<p>
				<label for="<?php 
        the_ddl_name_attr('video_height');
        ?>
"><?php 
        _e('Player height', 'ddl-layouts');
        ?>
:</label>
				<input type="number" name="<?php 
        the_ddl_name_attr('video_height');
        ?>
" value="300">
				<span class="desc"><?php 
        _e('Fixed height of the video player. Width adjusts to cell\'s size', 'ddl-layouts');
        ?>
</span>
			</p>
		</div>

		<?php 
        return ob_get_clean();
    }
    /**
     * Callback function that returns the user interface for the cell dialog.
     * 
     * Notice that we are using 'text_data' for the input element name.
     * This can then be accessed during frontend render using
     * $cell_settings['text_data']
     */
    public function dialog_template_callback()
    {
        ob_start();
        ?>

		<div class="ddl-form">
            <fieldset>
                <legend><?php 
        _e('BuddyPress Component:', 'ddl-layouts');
        ?>
</legend>
					<div class="fields-group">
                        <?php 
        $components = $this->get_eligible_components();
        foreach ($components as $component) {
            $name = $component->name;
            $slug = $component->slug;
            ?>
                            <p>
                                <label for="<?php 
            the_ddl_name_attr('bp_component_load');
            ?>
">
                                    <input type="radio" value="<?php 
            echo $slug;
            ?>
" name="<?php 
            the_ddl_name_attr('bp_component_load');
            ?>
"/>
                                    <span><?php 
            echo $name;
            ?>
</span>
                                </label>
                            </p>
                        <?php 
        }
        ?>
                    </div>
            </fieldset>
		</div>

		<?php 
        return ob_get_clean();
    }
function ddl_repeat_start($group_name, $button_text, $max_items = -1)
{
    global $ddl_repeats;
    array_push($ddl_repeats, array('group' => $group_name, 'button' => $button_text));
    ?>
		<div class="js-repeat-field-container ddl-repeat-field-container" data-max-items="<?php 
    echo $max_items;
    ?>
">
			<div class="ddl-repeat-field js-ddl-repeat-field" name="<?php 
    echo md5($button_text);
    ?>
">
				<div class="ddl-repeat-field-toolbar">
					<i class="icon-resize-vertical js-ddl-repeat-field-move"></i>
					<i class="icon-remove js-ddl-repeat-field-remove"></i>
				</div>
				<input type="hidden" name="<?php 
    the_ddl_name_attr('ddl-repeat-id');
    ?>
" />				
				
	<?php 
}
function reference_cell_dialog_template_callback()
{
    ob_start();
    ?>

		<?php 
    /*
     * Use the the_ddl_name_attr function to get the
     * name of the text box. Layouts will then handle loading and
     * saving of this UI element automatically.
     */
    ?>

		<div class="ddl-form reference-cell">

			<?php 
    // Display simple text input
    ?>
			<h3>
				<?php 
    _e('Text input', 'theme-context');
    ?>
			</h3>
			<p>
				<label for="<?php 
    the_ddl_name_attr('text_data');
    ?>
"><?php 
    _e('Cell data', 'theme-context');
    ?>
</label>
				<input type="text" name="<?php 
    the_ddl_name_attr('text_data');
    ?>
">
				<span class="desc"><?php 
    _e('Cell description', 'theme-context');
    ?>
</span>
			</p>

			<?php 
    // Display repeatable fields
    // Form elements wrapped in ddl_repeat_start() and ddl_repeat_end() functions will be repeatable
    ?>
			<h3>
				<?php 
    _e('Repeatable fields', 'theme-context');
    ?>
			</h3>
			<?php 
    ddl_repeat_start('gallery', __('Add another item', 'theme-context'), 4);
    // $group_name, $button_label, $max_items
    ?>
			<p>
				<label for="<?php 
    the_ddl_name_attr('gallery_item');
    ?>
"><?php 
    _e('Add image URL', 'theme-context');
    ?>
</label>
				<input type="text" name="<?php 
    the_ddl_name_attr('gallery_item');
    ?>
">
			</p>
			<?php 
    ddl_repeat_end();
    ?>

		</div>

	<?php 
    return ob_get_clean();
}
    function slider_cell_dialog_template_callback()
    {
        ob_start();
        ?>
 
		<div class="ddl-form">
			<p>
				<label for="<?php 
        the_ddl_name_attr('slider_height');
        ?>
"><?php 
        _e('Slider height', 'ddl-layouts');
        ?>
:</label>
				<input type="number" name="<?php 
        the_ddl_name_attr('slider_height');
        ?>
" value="300">
				<span class="desc"><?php 
        _e('px, number only', 'ddl-layouts');
        ?>
</span>
			</p>
			<p>
				<label for="<?php 
        the_ddl_name_attr('interval');
        ?>
"><?php 
        _e('Interval', 'ddl-layouts');
        ?>
:</label>
				<input type="number" name="<?php 
        the_ddl_name_attr('interval');
        ?>
" value="5000">
				<span class="desc"><?php 
        _e('The amount of time to delay between automatically cycling an item, ms.', 'ddl-layouts');
        ?>
</span>
			</p>
			<fieldset>
				<legend><?php 
        _e('Options', 'ddl-layouts');
        ?>
</legend>
				<div class="fields-group">
					<label class="checkbox" for="<?php 
        the_ddl_name_attr('autoplay');
        ?>
">
						<input type="checkbox" name="<?php 
        the_ddl_name_attr('autoplay');
        ?>
" id="<?php 
        the_ddl_name_attr('autoplay');
        ?>
" value="true">
						<?php 
        _e('Autoplay', 'ddl-layouts');
        ?>
					</label>
					<label class="checkbox" for="<?php 
        the_ddl_name_attr('pause');
        ?>
">
						<input type="checkbox" name="<?php 
        the_ddl_name_attr('pause');
        ?>
" id="<?php 
        the_ddl_name_attr('pause');
        ?>
" value="pause">
						<?php 
        _e('Pause on hover', 'ddl-layouts');
        ?>
					</label>
				</div>
			</fieldset>
            <fieldset>
				<legend><?php 
        _e('Image size', 'ddl-layouts');
        ?>
</legend>
				<div class="fields-group">
					<label class="checkbox" for="<?php 
        the_ddl_name_attr('image_size');
        ?>
">
						<input type="radio" name="<?php 
        the_ddl_name_attr('image_size');
        ?>
" id="<?php 
        the_ddl_name_attr('image_size');
        ?>
" checheked="checked" value="">
						<?php 
        _e('Contain (crop)', 'ddl-layouts');
        ?>
                        <span class="desc"><?php 
        _e('The background image will be scaled so that each side is as large as possible while not exceeding the length of the corresponding side of the container.', 'ddl-layouts');
        ?>
</span>
					</label>
					<label class="checkbox" for="<?php 
        the_ddl_name_attr('image_size');
        ?>
_cover">
						<input type="radio" name="<?php 
        the_ddl_name_attr('image_size');
        ?>
" id="<?php 
        the_ddl_name_attr('image_size');
        ?>
_cover" value="cover">
						<?php 
        _e('Cover (add padding)', 'ddl-layouts');
        ?>
                        <span class="desc"><?php 
        _e('The background image will be sized so that it is as small as possible while ensuring that both dimensions are greater than or equal to the corresponding size of the container.', 'ddl-layouts');
        ?>
</span>
                    </label>
				</div>
			</fieldset>

			<h3><?php 
        _e('Slides', 'ddl-layouts');
        ?>
</h3>

			<?php 
        ddl_repeat_start('slider', __('Add another slide', 'ddl-layouts'), 10);
        ?>

				<div class="js-ddl-media-field">
					<label for="<?php 
        the_ddl_name_attr('slide_url');
        ?>
"><?php 
        _e('Image', 'ddl-layouts');
        ?>
:</label>
					<input type="text" class="js-ddl-media-url" name="<?php 
        the_ddl_name_attr('slide_url');
        ?>
" />
					<p class="ddl-form-button-wrap">
						<button class="button js-ddl-add-media"
								data-uploader-title="<?php 
        _e('Choose an image', 'ddl-layouts');
        ?>
"
								data-uploader-button-text="Insert image URL"><?php 
        _e('Choose an image', 'ddl-layouts');
        ?>
						</button>
					</p>
				</div>
				<p>
					<label for="<?php 
        the_ddl_name_attr('slide_title');
        ?>
"><?php 
        _e('Caption title', 'ddl-layouts');
        ?>
:</label>
					<input type="text" name="<?php 
        the_ddl_name_attr('slide_title');
        ?>
">
				</p>
				<p>
					<label for="<?php 
        the_ddl_name_attr('slide_text');
        ?>
"><?php 
        _e('Caption description', 'ddl-layouts');
        ?>
:</label>
					<textarea name="<?php 
        the_ddl_name_attr('slide_text');
        ?>
" rows="3"></textarea>
					<span class="desc"><?php 
        _e('You can add HTML to the slide description.', 'ddl-layouts');
        ?>
</span>
				</p>

			<?php 
        ddl_repeat_end();
        ?>

		</div>
		<?php 
        return ob_get_clean();
    }
    private function _dialog_template()
    {
        add_filter('user_can_richedit', array(__CLASS__, '__true'), 100);
        ob_start();
        ?>
			<div class="ddl-form">

				<div class="ddl-form-item">
					<fieldset>
						<p class="fields-group">
							<label class="checkbox" for="<?php 
        the_ddl_name_attr('responsive_images');
        ?>
">
								<input type="checkbox" name="<?php 
        the_ddl_name_attr('responsive_images');
        ?>
" id="<?php 
        the_ddl_name_attr('responsive_images');
        ?>
">
								<?php 
        _e('Display images with responsive size', 'ddl-layouts');
        ?>
							</label>
						</p>
					</fieldset>
				</div>

				<div class="ddl-form-item">
					<fieldset>
						<p class="fields-group">
							<label class="checkbox" for="<?php 
        the_ddl_name_attr('disable_auto_p');
        ?>
">
								<input type="checkbox" name="<?php 
        the_ddl_name_attr('disable_auto_p');
        ?>
" id="<?php 
        the_ddl_name_attr('disable_auto_p');
        ?>
">
								<?php 
        _e('Disable automatic paragraphs', 'ddl-layouts');
        ?>
							</label>
						</p>
						
					</fieldset>
				</div>
				
				<div class="js-visual-editor-views-shortcode-notification"
					 data-view="<?php 
        esc_attr_e("It looks like you are trying to display a View. For your convenience, Layouts now comes with a View cell, which will let you achieve this much easier. We suggest that you try the new 'Views Content Grid' cell. You will be able to insert an existing View or create a new View.", 'ddl-layouts');
        ?>
"
					 data-content-template="<?php 
        esc_attr_e("It looks like you are trying to display fields. For your convenience, Layouts now comes with a Content Template cell, which will let you achieve this much easier.", 'ddl-layouts');
        ?>
"
					 data-cred="<?php 
        esc_attr_e("It looks like you are trying to display a Form. For your convenience, Layouts now comes with a CRED form cell, which will let you achieve this much easier. We suggest that you try the new 'CRED Form' cell. You will be able to insert an existing Form or create a new Form.", 'ddl-layouts');
        ?>
">
				</div>
			</div>

            <div id="visual-editor-editor-container" class="js-visual-editor-editor-container ddl-form">
                <div id="js-visual-editor-tinymce">
                    <?php 
        $this->do_tinymce();
        ?>
                </div>
                <div id="js-visual-editor-codemirror">
                    <?php 
        $this->do_codemirror();
        ?>
                </div>
                <div id="visual-editor-editor-switch-message"></div>
                <p id="visual-editor-editor-switch-container">
                    <a class="js-visual-editor-toggle" data-editor="tinymce"><?php 
        esc_attr_e('Switch to the WordPress Visual Editor', 'ddl-layouts');
        ?>
</a>
                    <a class="js-visual-editor-toggle" data-editor="codemirror"><?php 
        esc_attr_e('Switch to HTML editing', 'ddl-layouts');
        ?>
</a>
                    <input type="hidden" id="preferred_editor" value="<?php 
        $ddl_preferred_editor = get_user_option('ddl_preferred_editor', get_current_user_id());
        echo esc_attr($ddl_preferred_editor !== false ? $ddl_preferred_editor : 'tinymce');
        ?>
">
                </p>
            </div>

			<div class="ddl-form">
				<div class="ddl-form-item">
					<br />
					<?php 
        ddl_add_help_link_to_dialog(WPDLL_RICH_CONTENT_CELL, __('Learn about the Visual editor cell', 'ddl-layouts'));
        ?>
				</div>
			</div>
		<?php 
        return ob_get_clean();
    }
    private function _dialog_template()
    {
        ob_start();
        ?>
		<ul class="ddl-form">
			<li>
				<fieldset>
					<legend><?php 
        _e('Display content for:', 'ddl-layouts');
        ?>
</legend>
					<div class="fields-group">
						<ul>
							<li>
								<label class="post-content-page">
									<input type="radio" name="<?php 
        the_ddl_name_attr('page');
        ?>
" value="current_page" checked="checked"/>
									<?php 
        _e('Current page', 'ddl-layouts');
        ?>
								</label>
							</li>
							<li>
								<label class="post-content-page">
									<input type="radio" name="<?php 
        the_ddl_name_attr('page');
        ?>
" value="this_page" />
									<?php 
        _e('A specific page:', 'ddl-layouts');
        ?>
								</label>
							</li>
							<li id="js-post-content-specific-page">
								<select name="<?php 
        the_ddl_name_attr('post_content_post_type');
        ?>
" class="js-ddl-post-content-post-type" data-nonce="<?php 
        echo wp_create_nonce('ddl-post-content-post-type-select');
        ?>
">
									<option value="ddl-all-post-types"><?php 
        _e('All post types', 'ddl-layouts');
        ?>
</option>
									<?php 
        $post_types = get_post_types(array('public' => true), 'objects');
        foreach ($post_types as $post_type) {
            $count_posts = wp_count_posts($post_type->name);
            if ($count_posts->publish > 0) {
                ?>
												<option value="<?php 
                echo $post_type->name;
                ?>
"<?php 
                if ($post_type->name == 'page') {
                    echo ' selected="selected"';
                }
                ?>
>
													<?php 
                echo $post_type->labels->singular_name;
                ?>
												</option>
											<?php 
            }
        }
        ?>
								</select>
								<?php 
        $keys = array_keys($post_types);
        $post_types_array = array_shift($keys);
        $this->show_posts_dropdown($post_types_array, get_ddl_name_attr('selected_post'));
        ?>
							</li>
						</ul>
					</div>
				</fieldset>
			</li>
		

		</ul>
		<?php 
        ddl_add_help_link_to_dialog(WPDLL_POST_CONTENT_CELL, __('Learn about the Post Content cell', 'ddl-layouts'));
        ?>
		<?php 
        wp_nonce_field('wpv-ct-inline-edit', 'wpv-ct-inline-edit');
        ?>

		<?php 
        return ob_get_clean();
    }
?>
				</div> <!-- .ddl-popup-tab -->

			</div> <!-- .js-popup-tabs -->

		</div>

		<div class="ddl-dialog-footer js-dialog-footer">
			<?php 
wp_nonce_field('wp_nonce_edit_css', 'wp_nonce_edit_css');
?>
			<input id="ddl-layout-cell-unique-id-<?php 
echo $unique_id;
?>
" type="hidden" name=<?php 
the_ddl_name_attr('unique_id');
?>
 value=""/>
			<button class="button js-edit-dialog-close ddl-edit-dialog-close"><?php 
_e('Cancel', 'ddl-layouts');
?>
</button>
            <button data-close="no" class="button button-primary js-dialog-edit-save js-save-dialog-settings" data-create-text="<?php 
_e('Create', 'ddl-layouts');
?>
" data-update-text="<?php 
_e('Save', 'ddl-layouts');
?>
"><?php 
_e('Save', 'ddl-layouts');
?>
    function comments_cell_dialog_template_callback()
    {
        ob_start();
        ?>
		<h3 class="ddl-section-title">
			<?php 
        _e('Comments list', 'ddl-layouts');
        ?>
		</h3>
		<div class="ddl-form">
			<p>
				<label for="<?php 
        the_ddl_name_attr('avatar_size');
        ?>
"><?php 
        _e('Avatar size', 'ddl-layouts');
        ?>
:</label>
				<input type="number" value="24" placeholder="<?php 
        _e('32', 'ddl-layouts');
        ?>
" name="<?php 
        the_ddl_name_attr('avatar_size');
        ?>
" id="<?php 
        the_ddl_name_attr('avatar_size');
        ?>
" class="ddl-narrow-width" onkeypress='return event.charCode >= 48 && event.charCode <= 57'>
			</p>			
		</div>
		<h3 class="ddl-section-title">
			<?php 
        _e('Title for comments list', 'ddl-layouts');
        ?>
		</h3>
		<div class="ddl-form">
			<p>
				<label for="<?php 
        the_ddl_name_attr('title_one_comment');
        ?>
"><?php 
        _e('For one comment', 'ddl-layouts');
        ?>
:</label>
				<input type="text" name="<?php 
        the_ddl_name_attr('title_one_comment');
        ?>
" id="<?php 
        the_ddl_name_attr('title_one_comment');
        ?>
" value="<?php 
        _e('One thought on %TITLE%', 'ddl-layouts');
        ?>
">
				<div id="title_one_comment_message"></div>
			</p>
			<p>
				<label for="<?php 
        the_ddl_name_attr('title_multi_comments');
        ?>
"><?php 
        _e('For two or more', 'ddl-layouts');
        ?>
:</label>
				<input type="text" name="<?php 
        the_ddl_name_attr('title_multi_comments');
        ?>
" id="<?php 
        the_ddl_name_attr('title_multi_comments');
        ?>
" value="<?php 
        _e('%COUNT% thoughts on %TITLE%', 'ddl-layouts');
        ?>
">
				<div id="title_multi_comments_message"></div>
				<span class="desc"><?php 
        _e('Use the %TITLE% placeholder to display the post title and the %COUNT% placeholder to display the number of comments.', 'ddl-layouts');
        ?>
</span>
			</p>
		</div>
		<h3 class="ddl-section-title">
			<?php 
        _e('Navigation and miscellaneous texts', 'ddl-layouts');
        ?>
		</h3>
		<div class="ddl-form">			
			<p>
				<label for="<?php 
        the_ddl_name_attr('ddl_prev_link_text');
        ?>
"><?php 
        _e('Previous link text', 'ddl-layouts');
        ?>
:</label>
				<input type="text" name="<?php 
        the_ddl_name_attr('ddl_prev_link_text');
        ?>
" id="<?php 
        the_ddl_name_attr('ddl_prev_link_text');
        ?>
" value="<?php 
        _e('<< Older Comments', 'ddl-layouts');
        ?>
">
			</p>
			<p>
				<label for="<?php 
        the_ddl_name_attr('ddl_next_link_text');
        ?>
"><?php 
        _e('Next link text', 'ddl-layouts');
        ?>
:</label>
				<input type="text" name="<?php 
        the_ddl_name_attr('ddl_next_link_text');
        ?>
" id="<?php 
        the_ddl_name_attr('ddl_next_link_text');
        ?>
" value="<?php 
        _e('Newer Comments >>', 'ddl-layouts');
        ?>
">
			</p>
			<p>
				<label for="<?php 
        the_ddl_name_attr('comments_closed_text');
        ?>
"><?php 
        _e('Comments closed text', 'ddl-layouts');
        ?>
:</label>
				<input type="text" name="<?php 
        the_ddl_name_attr('comments_closed_text');
        ?>
" id="<?php 
        the_ddl_name_attr('comments_closed_text');
        ?>
" value="<?php 
        _e('Comments are closed', 'ddl-layouts');
        ?>
">
                <div id="comments_closed_text_message"></div>
			</p>
			<p>
				<label for="<?php 
        the_ddl_name_attr('reply_text');
        ?>
"><?php 
        _e('Reply text', 'ddl-layouts');
        ?>
:</label>
				<input type="text" name="<?php 
        the_ddl_name_attr('reply_text');
        ?>
" id="<?php 
        the_ddl_name_attr('reply_text');
        ?>
" value="<?php 
        _e('Reply', 'ddl-layouts');
        ?>
">
                <div id="reply_text_message"></div>
			</p>
			<p>
				<label for="<?php 
        the_ddl_name_attr('password_text');
        ?>
"><?php 
        _e('Password protected text', 'ddl-layouts');
        ?>
:</label>
				<input type="text" name="<?php 
        the_ddl_name_attr('password_text');
        ?>
" id="<?php 
        the_ddl_name_attr('password_text');
        ?>
" value="<?php 
        _e('This post is password protected. Enter the password to view any comments.', 'ddl-layouts');
        ?>
">
                <div id="password_text_message"></div>
			</p>

		</div>
		<div class="ddl-form">
			<div class="ddl-form-item">
				<br />
				<?php 
        ddl_add_help_link_to_dialog(WPDLL_COMMENTS_CELL, __('Learn about the Comments cell', 'ddl-layouts'));
        ?>
			</div>
		</div>
		<?php 
        global $current_user;
        get_currentuserinfo();
        ?>

		<?php 
        return ob_get_clean();
    }
        function cred_cell_dialog_template_callback()
        {
            ob_start();
            ?>

            <div class="ddl-form cred-edit-cells-form">
                <?php 
            if (defined('CRED_FORMS_CUSTOM_POST_NAME')) {
                ?>
                    <?php 
                require_once CRED_CLASSES_PATH . "/CRED.php";
                if (method_exists('CRED_CRED', 'is_embedded')) {
                    $cred_embedded = CRED_CRED::is_embedded();
                } else {
                    $cred_embedded = false;
                }
                ?>

                    <?php 
                if (!$cred_embedded) {
                    ?>
                        <fieldset>
                            <div class="fields-group">
                                <label class="radio">
                                    <input type="radio" name="cred-action" class="js-ddl-cred-form-create" value="new_form" >
                                    <?php 
                    _e('Create a new CRED Post Form', 'ddl-layouts');
                    ?>
                                </label>
                                <span class="desc ddl-form-indent js-ddl-newcred"><?php 
                    _e('CRED Post Forms allow you to create content or edit your content. Choose what you want this form to do and the type of content it will work with.', 'ddl-layouts');
                    ?>
</span>
                                <br class="js-ddl-newcred" />
                            </div>
                        </fieldset>

                        <fieldset class="js-ddl-newcred">
                            <legend><?php 
                    _e('This form will:', 'ddl-layouts');
                    ?>
</legend>
                            <select class="js-cred-new-mode ddl-form-indent">
                                <option value="new"><?php 
                    _e('Create content', 'ddl-layouts');
                    ?>
</option>
                                <option value="edit"><?php 
                    _e('Edit content', 'ddl-layouts');
                    ?>
</option>
                            </select>
                        </fieldset>

                        <fieldset class="js-ddl-newcred">
                            <?php 
                    $post_types = CRED_Loader::get('MODEL/Fields')->getPostTypes();
                    ?>

                            <legend><?php 
                    _e('Content type:', 'ddl-layouts');
                    ?>
</legend>
                            <select class="js-cred-post-type ddl-form-indent">
                                <?php 
                    foreach ($post_types as $post_type) {
                        ?>
                                    <option value="<?php 
                        echo $post_type['type'];
                        ?>
"><?php 
                        echo $post_type['name'];
                        ?>
</option>
                                <?php 
                    }
                    ?>
                            </select>

                        </fieldset>

                        <fieldset class="js-ddl-newcred">
                            <div class="fields-group ddl-form-indent">
                                <button class="button button-primary js-ddl-create-cred-form">
                                    <?php 
                    _e('Create Cell', 'ddl-layouts');
                    ?>
                                </button>
                                <p class="js-cred-form-create-error toolset toolset-alert-error alert ddl-form-input-alert" style="display:none">
                                </p>
                            </div>
                        </fieldset>
                    <?php 
                }
                // end of full cred.
                ?>

                    <fieldset class="ddl-dialog-fieldset">
                        <div class="fields-group" <?php 
                if ($cred_embedded) {
                    echo 'style="display:none"';
                }
                ?>
>
                            <label class="radio">
                                <input type="radio" name="cred-action" class="js-ddl-cred-form-existing" value="existing" >
                                <?php 
                _e('Use an existing CRED Post Form', 'ddl-layouts');
                ?>
                            </label>
                        </div>
                    </fieldset>


                    <fieldset class="js-ddl-select-existing-cred">
                        <legend><?php 
                _e('Form:', 'ddl-layouts');
                ?>
</legend>
                        <select name="<?php 
                the_ddl_name_attr('ddl_layout_cred_id');
                ?>
"
                                class="ddl-cred-select js-ddl-cred-select <?php 
                if (!$cred_embedded) {
                    echo 'ddl-form-indent';
                }
                ?>
"
                                data-new="<?php 
                _e('create', 'ddl-layout');
                ?>
"
                                data-edit="<?php 
                _e('edit', 'ddl-layouts');
                ?>
">

                            <option value=""><?php 
                _e('--- Select form ---', 'ddl-layouts');
                ?>
</option>';
                            <?php 
                $fm = CRED_Loader::get('MODEL/Forms');
                $posts = $fm->getAllForms();
                foreach ($posts as $post) {
                    $form = $fm->getForm($post->ID);
                    echo $this->ddl_cred_get_option_element($post->ID, $post->post_title, $form->fields['form_settings']->form['type'], $form->fields['form_settings']->post['post_type']);
                }
                ?>
                        </select>
                        <?php 
                if (!$cred_embedded) {
                    ?>
                            <div class="fields-group ddl-form-indent">
                                <button class="button button-primary js-ddl-edit-cred-link"
                                        data-close-cred-text="<?php 
                    _e('Save and Close this form and return to the layout', 'ddl-layouts');
                    ?>
"
                                        data-discard-cred-text="<?php 
                    _e('Close this form and discard any changes', 'ddl-layouts');
                    ?>
">
                                    <?php 
                    _e('Create Cell', 'ddl-layouts');
                    ?>
                                </button>
                            </div>
                        <?php 
                }
                ?>
                    </fieldset>

                    <?php 
                if ($cred_embedded) {
                    ?>
                        <fieldset>
                            <div class="fields-group">
                                <div class="toolset-alert toolset-alert-info">
                                    <?php 
                    _e('You are using the embedded version of CRED. Install and activate the full version of CRED and you will be able to create custom forms.', 'ddl-layouts');
                    ?>
                                    <br>
                                    <a class="fieldset-inputs" href="http://wp-types.com/home/cred/?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=cred-cell&utm_term=get-cred" target="_blank">
                                        <?php 
                    _e('About CRED', 'ddl-layouts');
                    ?>
                                    </a>

                                </div>
                            </div>
                        </fieldset>
                    <?php 
                }
                ?>

                <?php 
            } else {
                ?>
                    <div class="toolset-alert toolset-alert-info js-ddl-cred-not-activated">
                        <p>
                            <i class="icon-cred-logo ont-color-orange ont-icon-24"></i>
                            <?php 
                _e('This cell requires the CRED plugin. Install and activate the CRED plugin and you will be able to create custom forms for creating and editing content.', 'ddl-layouts');
                ?>
                            <br>
                            <br>

                            &nbsp;&nbsp;
                            <a class="fieldset-inputs" href="http://wp-types.com/home/cred/?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=cred-cell&utm_term=get-cred" target="_blank">
                                <?php 
                _e('About CRED', 'ddl-layouts');
                ?>
                            </a>

                        </p>
                    </div>
                <?php 
            }
            ?>

                <div>
                    <?php 
            ddl_add_help_link_to_dialog(WPDLL_CRED_CELL, __('Learn about the CRED Post Form cell', 'ddl-layouts'));
            ?>
                </div>


            </div>

            <div id="ddl-cred-preview" style="display:none">
                -			<p><strong><?php 
            _e('This form is used to %EDIT% %POST_TYPE%', 'ddl-layouts');
            ?>
</strong></p>
                <div class="ddl-cred-preview">
                    <img src="<?php 
            echo WPDDL_RES_RELPATH . '/images/cell-icons/cred-form.svg';
            ?>
" height="130px">
                </div>
            </div>

            <div id="ddl-cred-preview-cred-not-found" style="display:none">
                <h2><?php 
            _e('The CRED Post Form was not found. It may have been deleted.', 'ddl-layouts');
            ?>
</h2>
            </div>

            <?php 
            echo wp_nonce_field('ddl_layout_cred_nonce', 'ddl_layout_cred_nonce', true, false);
            return ob_get_clean();
        }
    function views_content_grid_dialog_template_callback()
    {
        global $WP_Views;
        ob_start();
        ?>
        <div class="ddl-form">
            <?php 
        echo wp_nonce_field('ddl_layout_view_nonce', 'ddl_layout_view_nonce', true, false);
        if (class_exists('WP_Views')) {
            if (defined('WPV_VERSION')) {
                if (version_compare(WPV_VERSION, '1.6.1', '<=')) {
                    ?>
                        <input type="hidden" value="0" class="js-views-content-is_views_installed" />
                        <input type="hidden" value="0" class="js-views-content-is_views_embedded" />
                        <div class="toolset-alert toolset-alert-info">
                            <p>
                                <i class="icon-views-logo ont-color-orange ont-icon-24"></i>
                                <?php 
                    _e('This cell requires Views plugin above version 1.6.1 to create custom content-driven cells.', 'ddl-layouts');
                    ?>



                                &nbsp;&nbsp;
                                <a class="fieldset-inputs" href="http://wp-types.com/home/views-create-elegant-displays-for-your-content?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=views-content-grid-cell&utm_term=get-views" target="_blank">
                                    <?php 
                    _e('About Views', 'ddl-layouts');
                    ?>
                                </a>

                            </p>
                        </div>
                    <?php 
                } else {
                    ?>
                        <input type="hidden" value="1" class="js-views-content-is_views_installed" />
                        <?php 
                    if ($WP_Views->is_embedded()) {
                        ?>
                            <input type="hidden" value="1" class="js-views-content-is_views_embedded" />
                        <?php 
                    } else {
                        ?>
                            <input type="hidden" value="0" class="js-views-content-is_views_embedded" />
                        <?php 
                    }
                    if (version_compare(WPV_VERSION, '1.7', '>=')) {
                        ?>
                            <input type="hidden" value="1" class="js-views-content-is_views_above_oneseven" />
                        <?php 
                    } else {
                        ?>
                            <input type="hidden" value="0" class="js-views-content-is_views_above_oneseven" />
                        <?php 
                    }
                    ?>

                        <fieldset class="js-view-result-missing" style="display:none; margin-top:-20px">
                            <div class="fields-group">
                                <div class="toolset-alert toolset-alert-warning">
                                    <p><i class="icon-warning-sign"></i> <?php 
                    _e('This layout has a search form, but is missing the results.', 'ddl-layouts');
                    ?>
</p>
                                    <div>
                                        <ul>
                                            <li>
                                                <label class="radio">
                                                    <input type="radio" class="js-ddl-complete-search" value="complete" data-cell-name-text="<?php 
                    _e('%CELL_NAME% search results', 'ddl-layouts');
                    ?>
" />
                                                    <?php 
                    _e('Complete the parametric search setup by inserting a cell for the results', 'ddl-layouts');
                    ?>
                                                </label>
                                            </li>
                                            <li>
                                                <label class="radio">
                                                    <input type="radio" class="js-ddl-different-view" value="cancel" />
                                                    <?php 
                    _e('Insert a different View, not related to the parametric search results', 'ddl-layouts');
                    ?>
                                                </label>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </fieldset>


                        <fieldset class="js-view-result-ok">
                            <legend><?php 
                    _e('View:', 'ddl-layouts');
                    ?>
</legend>
                            <div class="fields-group">
                                <?php 
                    if ($WP_Views->is_embedded()) {
                        ?>
                                    <p style="display: none;">
                                        <label class="radio">
                                            <input type="radio" name="view-grid-view-action" class="js-ddl-views-grid-create" value="new_layout" />
                                            <?php 
                        _e('Create new View', 'ddl-layouts');
                        ?>
                                        </label>
                                    </p>
                                    <p style="display:none;">
                                        <label class="radio">
                                            <input type="radio" name="view-grid-view-action" class="js-ddl-views-grid-existing" value="existing_layout" checked="checked" />
                                            <?php 
                        _e('Use an existing View', 'ddl-layouts');
                        ?>
                                        </label>
                                    </p>
                                <?php 
                    } else {
                        ?>
                                    <p>
                                        <label class="radio">
                                            <input type="radio" name="view-grid-view-action" class="js-ddl-views-dialog-mode js-ddl-views-grid-create" <?php 
                        checked(get_ddl_field('ddl_layout_view_id'), '');
                        ?>
 value="new_layout" />
                                            <?php 
                        _e('Create new View', 'ddl-layouts');
                        ?>
                                        </label>
                                    </p>
                                    <p>
                                        <label class="radio">
                                            <?php 
                        $checked = get_ddl_field('ddl_layout_view_id') != '' ? ' checked="checked" ' : '';
                        ?>
                                            <input type="radio" name="view-grid-view-action" class="js-ddl-views-dialog-mode js-ddl-views-grid-existing" value="existing_layout" <?php 
                        echo $checked;
                        ?>
 />
                                            <?php 
                        _e('Use an existing View', 'ddl-layouts');
                        ?>
                                        </label>
                                    </p>
                                <?php 
                    }
                    $hidden = '';
                    if (get_ddl_field('ddl_layout_view_id') == '') {
                        $hidden = ' style="display:none;" ';
                    }
                    ?>
                                <p class="js-ddl-select-existing-view"<?php 
                    echo $hidden;
                    ?>
>
                                    <?php 
                    $i = 0;
                    $wpv_args = array('post_type' => 'view', 'posts_per_page' => -1, 'order' => 'ASC', 'orderby' => 'title', 'post_status' => 'publish');
                    $wpv_query = get_posts($wpv_args);
                    $wpv_count_posts = count($wpv_query);
                    $views_as_options = '';
                    $wpv_total_archives = 0;
                    $wpv_total_views = 0;
                    if ($wpv_count_posts > 0) {
                        foreach ($wpv_query as $post) {
                            $view_settings = $WP_Views->get_view_settings($post->ID);
                            if (isset($view_settings['view-query-mode']) && $view_settings['view-query-mode'] == 'archive' || $view_settings['view-query-mode'] == 'layouts-loop') {
                                $wpv_total_archives++;
                            } else {
                                $wpv_total_views++;
                            }
                            if ($WP_Views->does_view_have_form_controls($post->ID)) {
                                $purpose = 'parametric';
                            } else {
                                $purpose = isset($view_settings['view_purpose']) ? $view_settings['view_purpose'] : 'full';
                                if ($purpose == 'bootstrap-grid') {
                                    $purpose = 'full';
                                }
                            }
                            $i++;
                            $views_query_mode = isset($view_settings['view-query-mode']) ? $view_settings['view-query-mode'] : 'normal';
                            $views_as_options .= '<option data-id="' . $post->ID . '" value="' . $post->ID . '" data-mode="' . $views_query_mode . '" data-purpose="' . $purpose . '">' . $post->post_title . '</option>';
                        }
                    }
                    ?>
                                    <input type="hidden" value="<?php 
                    echo $wpv_total_archives;
                    ?>
" class="js-wpv-total-archives" />
                                    <input type="hidden" value="<?php 
                    echo $wpv_total_views;
                    ?>
" class="js-wpv-total-views" />
                                    <?php 
                    if ($i > 0) {
                        ?>
                                    <select name="<?php 
                        the_ddl_name_attr('ddl_layout_view_id');
                        ?>
" class="ddl-view-select js-ddl-view-select">
                                        <option value="" data-mode="both"><?php 
                        _e('--- Select View ---', 'ddl-layouts');
                        ?>
</option>
                                        <?php 
                        echo $views_as_options;
                        ?>
                                    </select>
                                    <?php 
                        if ($WP_Views->is_embedded()) {
                            ?>
                                <div class="toolset-alert toolset-alert-info">
                                    <?php 
                            _e('You are using the embedded version of Views. Install and activate the full version of Views and you will be able to create custom content-driven grids.', 'ddl-layouts');
                            ?>

                                    &nbsp;&nbsp;
                                    <a class="fieldset-inputs" href="http://wp-types.com/home/views-create-elegant-displays-for-your-content?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=views-content-grid-cell&utm_term=get-views" target="_blank">
                                        <?php 
                            _e('About Views', 'ddl-layouts');
                            ?>
                                    </a>
                                </div>
                            <?php 
                        }
                    } else {
                        if ($WP_Views->is_embedded()) {
                            ?>
                                    <div class="toolset-alert toolset-alert-info js-data-embedded_no_views_at_all" data-embedded_no_views_at_all="yes">
                                        <?php 
                            _e('You are using the embedded version of the Views Plugin and there are no Views available.', 'ddl-layouts');
                            ?>
                                        <!--<br />
                                        <?php 
                            _e('You can download pre-built modules using the Module Manager plugin.', 'ddl-layouts');
                            ?>
                                        <br />
                                        <br />
                                        <?php 
                            if (defined('MODMAN_CAPABILITY')) {
                                ?>
                                            <a class="fieldset-inputs button button-primary-toolset" href="<?php 
                                echo admin_url('admin.php?page=ModuleManager_Modules&amp;tab=library&amp;module_cat=layouts');
                                ?>
" target="_blank">
                                                <i class="icon-download-alt"></i> <?php 
                                _e('Download Modules', 'ddl-layouts');
                                ?>
                                            </a>
                                        <?php 
                            } else {
                                ?>
                                            <a class="fieldset-inputs button button-primary-toolset" href="http://wp-types.com/home/module-manager?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=views-content-grid-cell&utm_term=get-module-manager" target="_blank">
                                                <?php 
                                _e('Get Module Manager plugin', 'ddl-layouts');
                                ?>
                                            </a>
                                        <?php 
                            }
                            ?>
                                        -->
                                    </div>
                                <?php 
                        } else {
                            ?>
                                    <select name="<?php 
                            the_ddl_name_attr('ddl_layout_view_id');
                            ?>
" class="ddl-view-select js-ddl-view-select" style="display:none;">
                                        <option value="" data-mode="both"><?php 
                            _e('None', 'ddl-layouts');
                            ?>
</option>
                                    </select>
                                    <?php 
                            /*<div class="toolset-alert toolset-alert-info">
                            			<?php _e('There are no Views available.', 'ddl-layouts'); ?>
                            			<br />
                            			<?php _e('You can create one or download pre-built modules using the Module Manager plugin.', 'ddl-layouts'); ?>
                            			<br />
                            			<br />
                            			<?php if (defined( 'MODMAN_CAPABILITY' )) { ?>
                            				<a class="fieldset-inputs button button-primary-toolset" href="<?php echo admin_url('admin.php?page=ModuleManager_Modules&amp;tab=library&amp;module_cat=layouts'); ?>" target="_blank">
                            					<i class="icon-download-alt"></i> <?php _e('Download Modules', 'ddl-layouts');?>
                            				</a>
                            			<?php } else { ?>
                            				<a class="fieldset-inputs button button-primary-toolset" href="http://wp-types.com/home/module-manager?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=views-content-grid-cell&utm_term=get-module-manager" target="_blank">
                            					<?php _e('Get Module Manager plugin', 'ddl-layouts');?>
                            				</a>
                            			<?php } ?>
                            		</div>
                            		<?php
                            		*/
                        }
                    }
                    ?>
                                <div class="toolset-alert toolset-alert-info js-no-views-message" style="display: none;">
                                    <span class="js-no-views-message-views" style="display: none;"><?php 
                    _e('There are no Views available.', 'ddl-layouts');
                    ?>
</span>
                                    <span class="js-no-views-message-archives" style="display: none;"><?php 
                    _e('There are no Archive Views available.', 'ddl-layouts');
                    ?>
</span>
                                    <!--<br />
                                    <?php 
                    _e('You can create one or download pre-built modules using the Module Manager plugin.', 'ddl-layouts');
                    ?>
                                    <br />
                                    <br />
                                    <?php 
                    if (defined('MODMAN_CAPABILITY')) {
                        ?>
                                        <a class="fieldset-inputs button button-primary-toolset" href="<?php 
                        echo admin_url('admin.php?page=ModuleManager_Modules&amp;tab=library&amp;module_cat=layouts');
                        ?>
" target="_blank">
                                            <i class="icon-download-alt"></i> <?php 
                        _e('Download Modules', 'ddl-layouts');
                        ?>
                                        </a>
                                    <?php 
                    } else {
                        ?>
                                        <a class="fieldset-inputs button button-primary-toolset" href="http://wp-types.com/home/module-manager?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=views-content-grid-cell&utm_term=get-module-manager" target="_blank">
                                            <?php 
                        _e('Get Module Manager plugin', 'ddl-layouts');
                        ?>
                                        </a>
                                    <?php 
                    }
                    ?>
                                    -->
                                </div>
                                </p>
                            </div>
                        </fieldset>
                        <?php 
                    $hidden = '';
                    if ($WP_Views->is_embedded()) {
                        $hidden = ' style="display:none;" ';
                    }
                    ?>
                        <fieldset class="js-ddl-set-view-purpose"<?php 
                    echo $hidden;
                    ?>
>
                            <legend><?php 
                    _e('View purpose:', 'ddl-layouts');
                    ?>
</legend>
                            <div class="fields-group ddl-form-indent" style="background:#f0f0f0;padding:1px 10px 10px">
                                <ul>
                                    <li>
                                        <label>
                                            <input type="radio" name="view_purpose" class="js-view-purpose" id="view_purpose_all" value="all" />
                                            <?php 
                    _e('Display all results', 'ddl-layouts');
                    ?>
                                        </label>
                                        <span class="desc"><?php 
                    _e('The View will output all the results returned from the query section.', 'ddl-layouts');
                    ?>
</span>
                                    </li>
                                    <li>
                                        <label>
                                            <input type="radio" name="view_purpose" class="js-view-purpose" id="view_purpose_pagination" value="pagination" />
                                            <?php 
                    _e('Display the results with pagination', 'ddl-layouts');
                    ?>
                                        </label>
                                        <span class="desc"><?php 
                    _e('The View will display the query results in pages.', 'ddl-layouts');
                    ?>
</span>
                                    </li>
                                    <li>
                                        <label>
                                            <input type="radio" name="view_purpose" class="js-view-purpose" id="view_purpose_slider" value="slider" />
                                            <?php 
                    _e('Display the results as a slider', 'ddl-layouts');
                    ?>
                                        </label>
                                        <span class="desc"><?php 
                    _e('The View will display the query results as slides.', 'ddl-layouts');
                    ?>
</span>
                                    </li>
                                    <li>
                                        <label>
                                            <input type="radio" name="view_purpose" class="js-view-purpose" id="view_purpose_parametric" value="parametric" />
                                            <?php 
                    _e('Display the results as a parametric search', 'ddl-layouts');
                    ?>
                                        </label>
                                        <span class="desc"><?php 
                    _e('Visitors will be able to search through your content using different search criteria.', 'ddl-layouts');
                    ?>
</span>
                                    </li>
                                    <li>
                                        <label>
                                            <input type="radio" name="view_purpose" class="js-view-purpose" id="view_purpose_full" value="full" checked="checked" />
                                            <?php 
                    _e('Full custom display mode', 'ddl-layouts');
                    ?>
                                        </label>
                                        <span class="desc"><?php 
                    _e('See all the View controls open and set up things manually.', 'ddl-layouts');
                    ?>
</span>
                                    </li>
                                </ul>
                            </div>
                        </fieldset>
                        <fieldset class="js-ddl-view-main-buttons">

                            <button data-close="no" class="button button-primary js-ddl-create-edit-view ddl-toolset-cell-button">
                                <?php 
                    _e('Create', 'ddl-layouts');
                    ?>
                            </button>
                        </fieldset>
                        <fieldset class="js-wpv-settings-views-layouts-parametric-extra" style="display:none">
                            <div id="views-layouts-parametric-div"
                                 class="wpv-setting-container js-wpv-display-for-purpose js-wpv-display-for-purpose-parametric"
                                 data-notice-1="<?php 
                    _e('Since you are only displaying the %NNN% in this cell, the %MMM% section is disabled. A parametric search should have the %NNN% and %MMM%. To display the %MMM% you need to:', 'ddl-layouts');
                    ?>
"
                                 data-notice-2="<?php 
                    _e('Create a different Layout cell and display this View.', 'ddl-layouts');
                    ?>
"
                                 data-notice-3="<?php 
                    _e('Choose to display the %MMM%', 'ddl-layouts');
                    ?>
"
                                 data-notice-form="<?php 
                    _e('search form', 'ddl-layouts');
                    ?>
"
                                 data-notice-results="<?php 
                    _e('search results', 'ddl-layouts');
                    ?>
"
                                >
                                <div class="wpv-setting js-wpv-setting">
                                    <h3><?php 
                    _e('What do you want to display in this cell?', 'ddl-layouts');
                    ?>
</h3>
                                    <ul>
                                        <li>
                                            <input type="radio" id="wpv-ddl-parametric-mode-full" class="js-wpv-ddl-parametric-mode" name="<?php 
                    the_ddl_name_attr('parametric_mode');
                    ?>
" value="full" />
                                            <label for="wpv-ddl-parametric-mode-full"><?php 
                    _e('The search form and the results', 'ddl-layouts');
                    ?>
</label>
                                        </li>
                                        <li>
                                            <input type="radio" id="wpv-ddl-parametric-mode-form" class="js-wpv-ddl-parametric-mode" name="<?php 
                    the_ddl_name_attr('parametric_mode');
                    ?>
" value="form" />
                                            <label for="wpv-ddl-parametric-mode-form"><?php 
                    _e('Only the search form', 'ddl-layouts');
                    ?>
</label>
                                            <div class="js-wpv-ddl-parametric-mode-form-settings wpv-advanced-setting" style="margin:10px 0 10px 20px;">
                                                <p>
                                                    <?php 
                    _e('Where do you want to display the results?', 'ddl-layouts');
                    ?>
                                                </p>
                                                <ul>
                                                    <li>
                                                        <input id="wpv-filter-form-target-self" value="self" type="radio" name="<?php 
                    the_ddl_name_attr('parametric_mode_target');
                    ?>
" class="js-wpv-ddl-parametric-target" />
                                                        <label for="wpv-filter-form-target-self"><?php 
                    _e('In other place on this same page', 'ddl-layouts');
                    ?>
</label>
                                                    </li>
                                                    <li>
                                                        <input id="wpv-filter-form-target-other" value="other" type="radio" name="<?php 
                    the_ddl_name_attr('parametric_mode_target');
                    ?>
" class="js-wpv-ddl-parametric-target" />
                                                        <label for="wpv-filter-form-target-other"><?php 
                    _e('On another page', 'ddl-layouts');
                    ?>
</label>
													<span class="toolset-alert" id="wpv-ddl-target-other-forbidden" style="display:none;">
														<?php 
                    _e('If you want to display the results on a different page, the View form must contain a search button', 'ddl-layouts');
                    ?>
													</span>
                                                    </li>
                                                </ul>
                                                <div class="js-wpv-ddl-parametric-target-other-div" style="margin:0 20px 10px;">
                                                    <p>
                                                        <label for="wpv-ddl-parametric-mode-form-target-title"><?php 
                    _e('Target page to show the results:', 'ddl-layouts');
                    ?>
</label>
                                                        <input type="text" id="wpv-ddl-parametric-mode-form-target-title" name="<?php 
                    the_ddl_name_attr('parametric_target_title');
                    ?>
" class="widefat js-wpv-widget-form-target-suggest-title" placeholder="<?php 
                    echo esc_attr(__('Please type', 'ddl-layouts'));
                    ?>
" />
                                                        <input type="hidden" id="wpv-ddl-parametric-mode-form-target-id" name="<?php 
                    the_ddl_name_attr('parametric_target_id');
                    ?>
" class="widefat js-wpv-widget-form-target-id" />
                                                    </p>
                                                    <div class="js-wpv-check-target-setup-box" style="display:none;">
                                                        <?php 
                    _e('Be sure to complete the setup:', 'ddl-layouts');
                    ?>
<br />
                                                        <a href="#" target="_blank" class="button-primary js-wpv-ddl-insert-view-form-target-set-existing-link" data-editurl="<?php 
                    echo admin_url('post.php');
                    ?>
?post="><?php 
                    _e('Add the search results to this page', 'ddl-layouts');
                    ?>
</a>
                                                        <a href="#" class="button-secondary js-wpv-ddl-discard-target-setup-link"><?php 
                    _e('Not now', 'ddl-layouts');
                    ?>
</a>
                                                    </div>
                                                </div>
                                            </div>
                                        </li>
                                        <li>
                                            <input type="radio" id="wpv-ddl-parametric-mode-results" class="js-wpv-ddl-parametric-mode" name="<?php 
                    the_ddl_name_attr('parametric_mode');
                    ?>
" value="results" />
                                            <label for="wpv-ddl-parametric-mode-results"><?php 
                    _e('Only the results', 'ddl-layouts');
                    ?>
</label>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </fieldset>
                    <?php 
                }
            } else {
                ?>
                    <input type="hidden" value="0" class="js-views-content-is_views_installed" />
                    <div class="toolset-alert toolset-alert-info">
                        <p>
                            <i class="icon-views-logo ont-color-orange ont-icon-24"></i>
                            <?php 
                _e('This cell requires Views plugin. Install and activate Views and you will be able to create custom content-driven cells.', 'ddl-layouts');
                ?>

                            &nbsp;&nbsp;
                            <a class="fieldset-inputs" href="http://wp-types.com/home/views-create-elegant-displays-for-your-content?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=views-content-grid-cell&utm_term=get-views" target="_blank">
                                <?php 
                _e('About Views', 'ddl-layouts');
                ?>
                            </a>
                        </p>
                    </div>
                <?php 
            }
        } else {
            ?>
                <input type="hidden" value="0" class="js-views-content-is_views_installed" />
                <div class="toolset-alert toolset-alert-info">
                    <p>
                        <i class="icon-views-logo ont-color-orange ont-icon-24"></i>
                        <?php 
            _e('This cell requires Views plugin. Install and activate Views and you will be able to create custom content-driven cells.', 'ddl-layouts');
            ?>

                        &nbsp;&nbsp;
                        <a class="fieldset-inputs" href="http://wp-types.com/home/views-create-elegant-displays-for-your-content?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=views-content-grid-cell&utm_term=get-views" target="_blank">
                            <?php 
            _e('About Views', 'ddl-layouts');
            ?>
                        </a>
                    </p>
                </div>
            <?php 
        }
        ?>
            <div class="js-views-content-grid-help">
                <?php 
        ddl_add_help_link_to_dialog(WPDLL_VIEWS_CONTENT_GRID_CELL, __('Learn about the Views cell', 'ddl-layouts'));
        ?>
            </div>
        </div>
        <?php 
        return ob_get_clean();
    }
    private function _dialog_template()
    {
        global $WPV_templates, $WP_Views;
        $views_1_6_available = defined('WPV_VERSION') && version_compare(WPV_VERSION, '1.6.1', '>') && isset($WP_Views) && class_exists('WP_Views') && !$WP_Views->is_embedded();
        $views_1_6_embedded_available = defined('WPV_VERSION') && version_compare(WPV_VERSION, '1.6.1', '>') && isset($WP_Views) && class_exists('WP_Views') && $WP_Views->is_embedded();
        $view_tempates_available = $this->_get_view_templates_available();
        ob_start();
        ?>
		<script type="text/javascript">
			var ddl_new_ct_default_name = '<?php 
        echo __('Content Template for %s Layout', 'ddl-layouts');
        ?>
';
			var ddl_views_1_6_available = <?php 
        echo $views_1_6_available ? 'true' : 'false';
        ?>
;
			var ddl_views_1_6_embedded_available = <?php 
        echo $views_1_6_embedded_available ? 'true' : 'false';
        ?>
;
		</script>

		<ul class="ddl-form">
			<li>
				<fieldset>
					<legend><?php 
        _e('Display content for:', 'ddl-layouts');
        ?>
</legend>
					<div class="fields-group">
						<ul>
							<li>
								<label class="post-content-page">
									<input type="radio" name="<?php 
        the_ddl_name_attr('page');
        ?>
" value="current_page" checked="checked"/>
									<?php 
        _e('A page using this layout', 'ddl-layouts');
        ?>
								</label>
							</li>
							<li>
								<label class="post-content-page">
									<input type="radio" name="<?php 
        the_ddl_name_attr('page');
        ?>
" value="this_page" />
									<?php 
        _e('A specific page:', 'ddl-layouts');
        ?>
								</label>
							</li>
							<li id="js-post-content-specific-page">
								<select name="<?php 
        the_ddl_name_attr('post_content_post_type');
        ?>
" class="js-ddl-post-content-post-type" data-nonce="<?php 
        echo wp_create_nonce('ddl-post-content-post-type-select');
        ?>
">
									<option value="ddl-all-post-types"><?php 
        _e('All post types', 'ddl-layouts');
        ?>
</option>
									<?php 
        $post_types = get_post_types(array('public' => true), 'objects');
        foreach ($post_types as $post_type) {
            $count_posts = wp_count_posts($post_type->name);
            if ($count_posts->publish > 0) {
                ?>
												<option value="<?php 
                echo $post_type->name;
                ?>
"<?php 
                if ($post_type->name == 'page') {
                    echo ' selected="selected"';
                }
                ?>
>
													<?php 
                echo $post_type->labels->singular_name;
                ?>
												</option>
											<?php 
            }
        }
        ?>
								</select>
								<?php 
        //	$keys = array_keys( $post_types );
        //	$post_types_array = array_shift(  $keys  );
        //	$this->show_posts_dropdown( $post_types_array, get_ddl_name_attr( 'selected_post' ) );
        ?>
							</li>
						</ul>
					</div>
				</fieldset>
			</li>

			<?php 
        if ($views_1_6_available || defined('WPV_VERSION') && sizeof($view_tempates_available) > 0) {
            ?>
			<li>
				<fieldset>
					<div class="fields-group">
						<ul>
							<li class="js-post-content-ct js-ct-selector js-ct-select-box">
								<?php 
            echo $this->_get_view_template_select_box($view_tempates_available);
            ?>
							</li>
							<?php 
            if ($views_1_6_available) {
                ?>
								<li class="js-post-content-ct js-ct-selector" style="text-align: right;">

                                    <a href="#" class="js-create-new-ct button button-large"><?php 
                _e('Create a new one', 'ddl-layouts');
                ?>
</a>
								</li>
							<?php 
            }
            ?>
						</ul>
					</div>
				</fieldset>
			</li>

			<?php 
        }
        ?>


			<?php 
        if ($views_1_6_available) {
            ?>
				<li class="js-post-content-ct js-ct-edit">
					<input class="js-ct-edit-name" type="text" style="float: left; width: 50%" /><span class="js-ct-editing"><strong><?php 
            _e('Editing', 'ddl-layouts');
            ?>
 :</strong> <span class="js-ct-name ct-name-span"></span></span>
                    <a style="float: right" href="#" class="js-load-different-ct button button-large"><?php 
            _e('Load a different Content Template', 'ddl-layouts');
            ?>
</a>
				</li>
				<li class="js-post-content-ct js-ct-edit">
			        <div class="js-wpv-ct-inline-edit wpv-ct-inline-edit wpv-ct-inline-edit hidden"><?php 
            echo '';
            ?>
</div>
				</li>
			<?php 
        } else {
            ?>
				<li>
					<div class="toolset-alert toolset-alert-info">
						<?php 
            if (sizeof($view_tempates_available) > 0) {
                ?>
							<p>
								<i class="icon-views-logo ont-color-orange ont-icon-24"></i>
								<?php 
                _e('This cell can display the post content using a Content Template, but your site does not have any Content Template yet. Install and activate the Views plugin, and you will be able to create Content Templates to display post fields', 'ddl-layouts');
                ?>

								&nbsp;&nbsp;
								<a class="fieldset-inputs" href="http://wp-types.com/home/views-create-elegant-displays-for-your-content?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=content-template-cell&utm_term=get-views" target="_blank">
									<?php 
                _e('About Views', 'ddl-layouts');
                ?>
								</a>
							</p>
						<?php 
            } else {
                ?>
							<p>
								<i class="icon-module-logo ont-color-orange ont-icon-24"></i>
								<?php 
                _e('This cell can display the post content using fields and there are no Content Templates available.', 'ddl-layouts');
                ?>
								<br />
								<?php 
                _e('You can download pre-built modules using the Module Manager plugin.', 'ddl-layouts');
                ?>
								<br />
								<br />
								<?php 
                if (defined('MODMAN_CAPABILITY')) {
                    ?>
									<a class="fieldset-inputs button button-primary-toolset" href="<?php 
                    echo admin_url('admin.php?page=ModuleManager_Modules&amp;tab=library&amp;module_cat=layouts');
                    ?>
" target="_blank">
										<i class="icon-download-alt"></i> <?php 
                    _e('Download Modules', 'ddl-layouts');
                    ?>
									</a>
								<?php 
                } else {
                    ?>
									<a class="fieldset-inputs button button-primary-toolset" href="http://wp-types.com/home/module-manager?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=content-template-cell&utm_term=get-module-manager" target="_blank">
										<?php 
                    _e('Get Module Manager plugin', 'ddl-layouts');
                    ?>
									</a>
								<?php 
                }
                ?>
							</p>
						<?php 
            }
            ?>
					</div>
				</li>
				<li class="js-post-content-ct js-ct-edit">
			        <div class="js-wpv-ct-inline-edit wpv-ct-inline-edit wpv-ct-inline-edit hidden"><?php 
            echo '';
            ?>
</div>
				</li>

			<?php 
        }
        ?>



		</ul>
		<?php 
        ddl_add_help_link_to_dialog(WPDLL_CONTENT_TEMPLATE_CELL, __('Learn about the Content Template cell', 'ddl-layouts'));
        ?>
		<?php 
        wp_nonce_field('wpv-ct-inline-edit', 'wpv-ct-inline-edit');
        ?>
        <?php 
        wp_nonce_field('wpv_inline_content_template', 'wpv_inline_content_template');
        ?>

		<?php 
        return ob_get_clean();
    }
    function imagebox_cell_dialog_template_callback()
    {
        ob_start();
        ?>

		<ul class="ddl-form">
			<li class="js-ddl-media-field">
				<label for="<?php 
        the_ddl_name_attr('box_image');
        ?>
"><?php 
        _e('Image URL', 'ddl-layouts');
        ?>
:</label>
				<input type="text" class="js-ddl-media-url" name="<?php 
        the_ddl_name_attr('box_image');
        ?>
" />
				<div class="ddl-form-button-wrap">
					<button class="button js-ddl-add-media"
							data-uploader-title="<?php 
        _e('Choose an image', 'ddl-layouts');
        ?>
"
							data-uploader-button-text="<?php 
        _e('Insert image URL', 'ddl-layouts');
        ?>
">
							<?php 
        _e('Choose an image', 'ddl-layouts');
        ?>
					</button>
                    
				</div>
			</li>
            <li class="ddl-form-button-wrap">
				<label for="<?php 
        the_ddl_name_attr('disable_bootstrap_thumbnail');
        ?>
"></label>
				<?php 
        _e('Disable Bootstrap "thumbnail"', 'ddl-layouts');
        ?>
 <input type="checkbox" name="<?php 
        the_ddl_name_attr('disable_bootstrap_thumbnail');
        ?>
">
			</li>  
            <li>
				<label for="<?php 
        the_ddl_name_attr('box_title');
        ?>
"><?php 
        _e('Caption title', 'ddl-layouts');
        ?>
:</label>
				<input type="text" name="<?php 
        the_ddl_name_attr('box_title');
        ?>
">
			</li>			
			<li>
				<label for="<?php 
        the_ddl_name_attr('box_content');
        ?>
"><?php 
        _e('Caption description', 'ddl-layouts');
        ?>
:</label>
				<textarea name="<?php 
        the_ddl_name_attr('box_content');
        ?>
" rows="4"></textarea>
			</li>
                      
		</ul>
		<?php 
        return ob_get_clean();
    }
function widget_cell_dialog_template_callback()
{
    if (!empty($GLOBALS['wp_widget_factory'])) {
        $widgets = $GLOBALS['wp_widget_factory']->widgets;
    } else {
        $widgets = array();
    }
    add_action('wp_ajax_get_widget_controls', 'widget_cell_get_controls');
    ob_start();
    ?>

		<?php 
    /*
     * Use the the_ddl_name_attr function to get the
     * name of the text box. Layouts will then handle loading and
     * saving of this UI element automatically.
     */
    ?>

		<ul class="ddl-form widget-cell">
			<li>
				<label for="<?php 
    the_ddl_name_attr('widget_type');
    ?>
"><?php 
    _e('Widget type:', 'ddl-layouts');
    ?>
</label>
				<select name="<?php 
    the_ddl_name_attr('widget_type');
    ?>
" data-nonce="<?php 
    echo wp_create_nonce('ddl-get-widget');
    ?>
">
					<?php 
    foreach ($widgets as $widget) {
        ?>
						<?php 
        if (!is_array($widget->widget_options['classname']) && !is_array($widget->name)) {
            ?>
							<option value="<?php 
            echo $widget->widget_options['classname'];
            ?>
"><?php 
            echo $widget->name;
            ?>
</option>
						<?php 
        }
        ?>
					<?php 
    }
    ?>
				</select>
			</li>
			<li>
				<fieldset class="js-widget-cell-fieldset hidden">
					<legend><?php 
    _e('Widget settings', 'ddl-layouts');
    ?>
:</legend>
					<div class="fields-group widget-cell-controls js-widget-cell-controls">
					</div>
				</fieldset>
			</li>

			<li>
				<?php 
    ddl_add_help_link_to_dialog(WPDLL_WIDGET_CELL, __('Learn about the Widget cell', 'ddl-layouts'));
    ?>
			</li>			
			
		</ul>

	<?php 
    return ob_get_clean();
}
    function menu_cell_dialog_template_callback()
    {
        ob_start();
        ?>

		<div class="ddl-form">
			<p>
				<label for="<?php 
        the_ddl_name_attr('menu_name');
        ?>
"><?php 
        _e('Select menu', 'ddl-layouts');
        ?>
</label>
				<?php 
        $menus = get_terms('nav_menu');
        if (count($menus) > 0) {
            ?>
				<select name="<?php 
            the_ddl_name_attr('menu_name');
            ?>
">

				<?php 
            foreach ($menus as $menu) {
                $name = $menu->name;
                ?>
					<option value="<?php 
                echo $name;
                ?>
"><?php 
                echo $name;
                ?>
</option>
				<?php 
            }
            ?>

				</select>
					<?php 
        } else {
            ?>
							<span class="toolset-alert toolset-alert-info ddl-dialog-form-message"><?php 
            printf(__('There are no menus available, create your menus in %sEdit Menus%s page first.', 'ddl-layouts'), '<a href="' . admin_url('nav-menus.php', 'admin') . '">', '</a>');
            ?>
</span>
					<?php 
        }
        ?>
			</p>
			<p>
				<label for="<?php 
        the_ddl_name_attr('menu_dir');
        ?>
"><?php 
        _e('Menu style', 'ddl-layouts');
        ?>
</label>
				<select name="<?php 
        the_ddl_name_attr('menu_dir');
        ?>
">
					<option value="nav-horizontal"><?php 
        _e('Top Bar menu (horizontal)', 'ddl-layouts');
        ?>
</option>
					<option value="nav-stacked"><?php 
        _e('Sidebar menu (vertical)', 'ddl-layouts');
        ?>
</option>
				</select>
			</p>


			<p>
				<label for="<?php 
        the_ddl_name_attr('menu_depth');
        ?>
"><?php 
        _e('Navigation levels', 'ddl-layouts');
        ?>
</label>
				<select name="<?php 
        the_ddl_name_attr('menu_depth');
        ?>
">
					<option value="-1"><?php 
        _e('All items in a flat menu', 'ddl-layouts');
        ?>
</option>
					<option value="0"><?php 
        _e('All levels', 'ddl-layouts');
        ?>
</option>
					<option value="1"><?php 
        _e('Level one', 'ddl-layouts');
        ?>
</option>
					<option value="2"><?php 
        _e('Level two', 'ddl-layouts');
        ?>
</option>
					<option value="3"><?php 
        _e('Level three', 'ddl-layouts');
        ?>
</option>
				</select>
			</p>

			<!--<p>
				<label for="<?php 
        the_ddl_name_attr('menu_drop_down');
        ?>
"><?php 
        _e('Sub menu style', 'ddl-layouts');
        ?>
</label>
				&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="<?php 
        the_ddl_name_attr('menu_drop_down');
        ?>
" value="bootstrap" checked />Drop down menu &nbsp;
				<input type="radio" name="<?php 
        the_ddl_name_attr('menu_drop_down');
        ?>
" value="default" />Flat menu

			</p>-->
		</div>

		<?php 
        return ob_get_clean();
    }