Count Number of Blocks Used Sitewide

Permalink
I need to show the number of blocks being used sitewide, from a specific package. The count will be shown in a dashboard page.

There are 4 blocks in the package, and I want to show the number of each used across the site. How can I do this?

PineCreativeLabs
View Replies: View Best Answer
pvernaglia replied on at Permalink Best Answer Reply
pvernaglia
Have a look at the concrete/controllers/single_pages/dashboard/blocks/types.php. I think you will find it all there.

public function inspect($btID = 0)
    {
        if ($btID > 0) {
            $bt = BlockType::getByID($btID);
        }
        if (isset($bt) && ($bt instanceof BlockTypeEntity)) {
            $this->set('bt', $bt);
            $this->set('num', $bt->getCount());
            $this->set('numActive', $bt->getCount(true));
        } else {
            $this->redirect('/dashboard/blocks/types');
        }
    }
PineCreativeLabs replied on at Permalink Reply 1 Attachment
PineCreativeLabs
Thanks for the pointer! I've gotten it working in my dashboard! See screenshot.