source/php/Search.php
public function getRenderedPostModules($post)
    {
        if (!$post) {
            return;
        }

        if (is_array($post)) {
            $postId = $post['ID'];
        } else {
            $postId = $post->ID;
        }

        $modules = \Modularity\Editor::getPostModules($postId);
        $onlyModules = array();

        // Normalize modules array
        foreach ($modules as $sidebar => $item) {
            if (!isset($item['modules']) || count($item['modules']) === 0) {
                continue;
            }

            $onlyModules = array_merge($onlyModules, $item['modules']);
        }

        // Render modules and append to post content
        $rendered = "<br><br>";
        foreach ($onlyModules as $module) {
            if ($module->post_type === 'mod-wpwidget') {
                continue;
            }

            $markup = \Modularity\App::$display->outputModule($module, array('edit_module' => false), array(), false);
            $rendered .= $markup;
        }

        return $rendered;
    }
public function getRenderedPostModules($post)
    {
        if (!$post) {
            return;
        }

        if (is_array($post)) {
            $postId = $post['ID'];
        } else {
            $postId = $post->ID;
        }

        $modules = \Modularity\Editor::getPostModules($postId);
        $onlyModules = array();

        // Normalize modules array
        foreach ($modules as $sidebar => $item) {
            if (!isset($item['modules']) || count($item['modules']) === 0) {
                continue;
            }

            $onlyModules = array_merge($onlyModules, $item['modules']);
        }

        // Render modules and append to post content
        $rendered = "<br><br>";
        foreach ($onlyModules as $module) {
            if ($module->post_type === 'mod-wpwidget') {
                continue;
            }

            $markup = \Modularity\App::$display->outputModule($module, array('edit_module' => false), array(), false);
            $rendered .= $markup;
        }

        return $rendered;
    }
public function getRenderedPostModules ( $ post ) { if ( ! $ post ) { return ; } if ( is_array ( $ post ) ) { $ postId = $ post [ 'ID' ] ; } else { $ postId = $ post -> ID ; } $ modules = \ Modularity \ Editor :: getPostModules ( $ postId ) ; $ onlyModules = array ( ) ; // Normalize modules array foreach ( $ modules as $ sidebar => $ item ) { if ( ! isset ( $ item [ 'modules' ] ) || count ( $ item [ 'modules' ] ) === 0 ) { continue ; } $ onlyModules = array_merge ( $ onlyModules , $ item [ 'modules' ] ) ; } // Render modules and append to post content $ rendered = "<br><br>" ; foreach ( $ onlyModules as $ module ) { if ( $ module -> post_type === 'mod-wpwidget' ) { continue ; } $ markup = \ Modularity \ App :: $ display -> outputModule ( $ module , array ( 'edit_module' => false ) , array ( ) , false ) ; $ rendered .= $ markup ; } return $ rendered ; }
Render all modules on post
@param  WP_Post $post
@return string
Render all modules on post