public function is_block_present($blockname) {
        if (empty($this->blockinstances)) {
            return false;
        }

        $requiredbythemeblocks = $this->get_required_by_theme_block_types();
        foreach ($this->blockinstances as $region) {
            foreach ($region as $instance) {
                if (empty($instance->instance->blockname)) {
                    continue;
                }
                if ($instance->instance->blockname == $blockname) {
                    if ($instance->instance->requiredbytheme) {
                        if (!in_array($blockname, $requiredbythemeblocks)) {
                            continue;
                        }
                    }
                    return true;
                }
            }
        }
        return false;
    }
public function is_block_present($blockname) {
        if (empty($this->blockinstances)) {
            return false;
        }

        $requiredbythemeblocks = $this->get_required_by_theme_block_types();
        foreach ($this->blockinstances as $region) {
            foreach ($region as $instance) {
                if (empty($instance->instance->blockname)) {
                    continue;
                }
                if ($instance->instance->blockname == $blockname) {
                    if ($instance->instance->requiredbytheme) {
                        if (!in_array($blockname, $requiredbythemeblocks)) {
                            continue;
                        }
                    }
                    return true;
                }
            }
        }
        return false;
    }
public function is_block_present ( $ blockname ) { if ( empty ( $ this -> blockinstances ) ) { return false ; } $ requiredbythemeblocks = $ this -> get_required_by_theme_block_types ( ) ; foreach ( $ this -> blockinstances as $ region ) { foreach ( $ region as $ instance ) { if ( empty ( $ instance -> instance -> blockname ) ) { continue ; } if ( $ instance -> instance -> blockname == $ blockname ) { if ( $ instance -> instance -> requiredbytheme ) { if ( ! in_array ( $ blockname , $ requiredbythemeblocks ) ) { continue ; } } return true ; } } } return false ; }
Given a block name, find out of any of them are currently present in the page

@param string $blockname - the basic name of a block (eg "navigation")
@return boolean - is there one of these blocks in the current page?
Given a block name find out of any of them are currently present in the page