function frontend_render_cell_content($target)
 {
     global $WPV_templates;
     $content = '';
     $cell_content = $this->get_content();
     if ($cell_content['page'] == 'current_page') {
         do_action('ddl-layouts-render-start-post-content');
     }
     if (isset($WPV_templates) && isset($cell_content['ddl_view_template_id']) && $cell_content['ddl_view_template_id'] != 'None') {
         $content_template_id = $cell_content['ddl_view_template_id'];
         if ($cell_content['page'] == 'current_page') {
             global $post;
             $content = render_view_template($content_template_id, $post);
         } elseif ($cell_content['page'] == 'this_page') {
             $get_post_query = new WP_Query(array('p' => $cell_content['selected_post'], 'post_type' => 'any'));
             while ($get_post_query->have_posts()) {
                 $get_post_query->the_post();
                 $content = render_view_template($content_template_id);
             }
             wp_reset_postdata();
         }
         $content = do_shortcode(apply_filters('ddl-content-template-cell-do_shortcode', $content, $this));
     } else {
         $content = WPDDL_Messages::views_missing_message();
     }
     $target->cell_content_callback($content, $this);
     if ($cell_content['page'] == 'current_page') {
         do_action('ddl-layouts-render-end-post-content');
     }
 }
 function frontend_render_cell_content($target)
 {
     global $ddl_fields_api;
     $ddl_fields_api->set_current_cell_content($this->get_content());
     if (function_exists('render_view')) {
         global $WPV_view_archive_loop, $wp_query;
         $WPV_view_archive_loop->query = clone $wp_query;
         $WPV_view_archive_loop->in_the_loop = true;
         $target->cell_content_callback(render_view(array('id' => get_ddl_field('ddl_layout_view_id'))), $this);
         $WPV_view_archive_loop->in_the_loop = false;
     } else {
         $target->cell_content_callback(WPDDL_Messages::views_missing_message(), $this);
     }
 }
 /**
  * waiting for export messages implementation on MM side
  */
 function handle_message_for_posts_belong()
 {
     $true = array_filter($this->track_has_posts, array(new Toolset_ArrayUtils(null, true), 'value_in_array'));
     if (count($true) === 0) {
         return;
     }
     $html = '';
     foreach ($this->track_has_posts as $layout => $bool) {
         if ($bool === true) {
             $html .= __('The %s layout you are exporting is used to display single pages. Please note that when you import this module on another site, the layout will not be assigned to specific pages, so you will need to edit the layout and assign it manually.', 'ddl-layouts');
         }
     }
     return WPDDL_Messages::dismissible_notice('ddl-layouts-has-posts-notice', $html);
 }
    function video_cell_content_callback()
    {
        $video_url = get_ddl_field('video_url');
        $filter = '#^(?:https?://)?(?:www\\.)?(?:youtu\\.be/|youtube\\.com(?:/embed/|/v/|/watch\\?v=|/watch\\?.+&v=))([\\w-]{11})(?:.+)?$#x';
        preg_match($filter, $video_url, $matches);
        if (isset($matches[1])) {
            $video_id = $matches[1];
        } else {
            $video_id = null;
        }
        ob_start();
        ?>

		<style>
			.video-container iframe {
				width: 100%;
			}
		</style>

            <?php 
        if ($video_id === null) {
            ?>

            <div class="video-container">
                <?php 
            echo WPDDL_Messages::display_message(WPDDL_Messages::$message_warning, sprintf(__('The URL %s is not a valid YouTube URL.', 'ddl-layouts'), $video_url));
            ?>
            </div>

            <?php 
        } else {
            ?>

			<div class="video-container">
				<iframe height="<?php 
            the_ddl_field('video_height');
            ?>
" src="//www.youtube.com/embed/<?php 
            echo $video_id;
            ?>
" frameborder="0" ></iframe>
			</div>

            <?php 
        }
        ?>

		<?php 
        return ob_get_clean();
    }
 function cred_cell_content_callback()
 {
     if (defined('CRED_FORMS_CUSTOM_POST_NAME')) {
         $fm = CRED_Loader::get('MODEL/Forms');
         $form = $fm->getForm(get_ddl_field('ddl_layout_cred_id'));
         if ($form) {
             return do_shortcode('[cred-form form="' . get_ddl_field('ddl_layout_cred_id') . '"]');
         } else {
             return WPDDL_Messages::cred_form_missing_message();
         }
     } else {
         return WPDDL_Messages::cred_missing_message();
     }
 }
 function views_content_grid_content_callback()
 {
     //Render View
     if (function_exists('render_view')) {
         $mode = get_ddl_field('parametric_mode');
         $target = get_ddl_field('parametric_mode_target');
         $target_id = get_ddl_field('parametric_target_id');
         if ($target == 'self') {
             $target_id = 'self';
         }
         if ($mode == 'form' && !empty($target_id)) {
             return render_view(array('id' => get_ddl_field('ddl_layout_view_id'), 'target_id' => $target_id));
         } else {
             if ($mode == 'results') {
                 return render_view(array('id' => get_ddl_field('ddl_layout_view_id'), 'view_display' => 'layout'));
             } else {
                 return render_view(array('id' => get_ddl_field('ddl_layout_view_id')));
             }
         }
     } else {
         return WPDDL_Messages::views_missing_message();
     }
 }