protected function buildElementsByBlock($elements)
    {
        if (empty($elements)) {
            return $elements;
        }

        $output = [];
        foreach ($elements as $element) {
            $output[$element->block_key][] = $element;
        }

        return $output;
    }
protected function buildElementsByBlock($elements)
    {
        if (empty($elements)) {
            return $elements;
        }

        $output = [];
        foreach ($elements as $element) {
            $output[$element->block_key][] = $element;
        }

        return $output;
    }
protected function buildElementsByBlock ( $ elements ) { if ( empty ( $ elements ) ) { return $ elements ; } $ output = [ ] ; foreach ( $ elements as $ element ) { $ output [ $ element -> block_key ] [ ] = $ element ; } return $ output ; }
Build Page Elements by Block

Takes array of page elements and changes keys to use block->key as array keys
@param array  $elements Array of page element domain models
@return array
Build Page Elements by Block