Output Fields in Teamplate form Pages Queried and Checked in the Panel

Hello people.

I need help with outputting some elements (fields) that are belong to pages which are listed and selected in panel.

Let me explain:

I have unlisted pageA that contains dozens of subpages (in this case called Providers).

I also have pageB that contains several blog posts.

When I edit a post from pageB, there is a list of all pageA subpages (providers) there which I got using the query:

–type: fields
----label: Providers
----type: checkboxes
----options: query
----query: site.find(“pageA”).children

So after I check (select) few pages I would like to use foreach and output fields that belong to those selected pages.
That foreach will be added to template that is used for pageB blog posts.

Any help or clue is highly appreciated.

Thank you.

To turn the values from the field into a pages collection:

$providers = $page->providers()->toPages();

You can then loop through these $providers and output the desired content, in this example the title, but you have of course access to all information:

<?php foreach ($providers as $provider): ?>
  <?= echo $provider->title()->html() ?>
<?php endforeach ?>

Thank you very much.
Your solution is beautiful.