source/php/Editor.php
public function addSidebarsMetaBoxes()
    {
        global $wp_registered_sidebars;

        $template = \Modularity\Helper\Post::getPostTemplate();
        $sidebars = null;

        $activeAreas = $this->getActiveAreas($template);


        // Add no active sidebars message if no active sidebars exists
        if (is_array($activeAreas) && count($activeAreas) === 0) {
            add_meta_box(
                'no-sidebars',
                __('No active sidebar areas', 'modularity'),
                function () {
                    echo '<p>' . __('There\'s no active sidebars. Please activate sidebar areas in the Modularity Options to add modules.', 'modularity') . '</p>';
                },
                $this->screenHook,
                'normal',
                'low',
                null
            );

            return;
        }

        if (is_array($activeAreas) && !empty($activeAreas)) {
            foreach ($activeAreas as $area) {
                if (isset($wp_registered_sidebars[$area])) {
                    $sidebars[$area] = $wp_registered_sidebars[$area];
                }
            }

            if (is_array($sidebars)) {
                foreach ($sidebars as $sidebar) {
                    $this->sidebarMetaBox($sidebar);
                }
            }
        }
    }
public function addSidebarsMetaBoxes()
    {
        global $wp_registered_sidebars;

        $template = \Modularity\Helper\Post::getPostTemplate();
        $sidebars = null;

        $activeAreas = $this->getActiveAreas($template);


        // Add no active sidebars message if no active sidebars exists
        if (is_array($activeAreas) && count($activeAreas) === 0) {
            add_meta_box(
                'no-sidebars',
                __('No active sidebar areas', 'modularity'),
                function () {
                    echo '<p>' . __('There\'s no active sidebars. Please activate sidebar areas in the Modularity Options to add modules.', 'modularity') . '</p>';
                },
                $this->screenHook,
                'normal',
                'low',
                null
            );

            return;
        }

        if (is_array($activeAreas) && !empty($activeAreas)) {
            foreach ($activeAreas as $area) {
                if (isset($wp_registered_sidebars[$area])) {
                    $sidebars[$area] = $wp_registered_sidebars[$area];
                }
            }

            if (is_array($sidebars)) {
                foreach ($sidebars as $sidebar) {
                    $this->sidebarMetaBox($sidebar);
                }
            }
        }
    }
public function addSidebarsMetaBoxes ( ) { global $ wp_registered_sidebars ; $ template = \ Modularity \ Helper \ Post :: getPostTemplate ( ) ; $ sidebars = null ; $ activeAreas = $ this -> getActiveAreas ( $ template ) ; // Add no active sidebars message if no active sidebars exists if ( is_array ( $ activeAreas ) && count ( $ activeAreas ) === 0 ) { add_meta_box ( 'no-sidebars' , __ ( 'No active sidebar areas' , 'modularity' ) , function ( ) { echo '<p>' . __ ( 'There\'s no active sidebars. Please activate sidebar areas in the Modularity Options to add modules.' , 'modularity' ) . '</p>' ; } , $ this -> screenHook , 'normal' , 'low' , null ) ; return ; } if ( is_array ( $ activeAreas ) && ! empty ( $ activeAreas ) ) { foreach ( $ activeAreas as $ area ) { if ( isset ( $ wp_registered_sidebars [ $ area ] ) ) { $ sidebars [ $ area ] = $ wp_registered_sidebars [ $ area ] ; } } if ( is_array ( $ sidebars ) ) { foreach ( $ sidebars as $ sidebar ) { $ this -> sidebarMetaBox ( $ sidebar ) ; } } } }
Loops registered sidebars and creates metaboxes for them
@return  void
Loops registered sidebars and creates metaboxes for them