public function getVisibleBlocks(array $ids, Language $language, $onlyActive = true)
    {
        $query = Block::query()->with(self::$loadRelations);

        if (!empty($ids)) {
            $query->where(function ($query) use ($ids) {
                $query->whereIn('id', $ids)
                    ->orWhere('filter', null);
            });

        } else { // blocks on all pages only
            $query->where('filter', null);
        }

        if ($onlyActive) {
            $query->whereHas('translations', function ($query) use ($language) {
                $query->where('block_translations.is_active', true)
                    ->where('language_code', $language->code);
            })->where('is_active', '=', true);
        }

        $blocks = $query->orderBy('weight', 'ASC')->get();

        return $blocks;
    }