0

I was busy attaching dataobjects under category pages of which some are under different subsites. But I can't see these pages of other subsites on my dataobjects which makes sense.

At first I tried to make a custom array which includes the category data from the database. But this returned an error since the data is read out by a GridField and my array is not an SS_LIST.

What I want to do is allow these specific pages to show on all subsites by means of something simple like a checkbox. Is there a way to achieve this?

1 Answers1

3

For one specific page you can link it to each Subsite manually using SubsitesVirtualPage.

Subsites utilizes AugmentDatabase which magically filters for the current SubsiteID. If you want to add those pages globally it becomes tricky.

If it's just some lists, like e.g. in the Footer, you can do something like:

$list = Page::get()->filter(...);
$list->alterDataQuery(
    function ($query, $list) {
        $query->setQueryParam('Subsite.filter', false);
    }
);

So this specific list will NOT filter for the current subsite. You can pass the DataList and refine it later (e.g. add additional filters, limit, sort etc..)

A global solution would be to adjust Subsite's extension that does the filtering to your needs.

wmk
  • 4,531
  • 1
  • 18
  • 37