Use multiselect as a menu

Hi,
I’m new in kirby, I’m making a website with article, in the panel I have created a multiselect checkbox, to link the article to an option of my multi select. But I would to fetch all the option of my multi select field as a menu where when you click on an option, this action display only the related articles

there is my multi select field :

    theme:
    label: Theme
    type: multiselect
    required: true
    options:
      Brevets: Brevets
      Technologies: Technologies
      Comportements: Comportements
      Besoins: Besoins
      Gestes: Gestes  
      Œuvres: Œuvres

there how my menu is for the moment:

    	<div id="info">
	
			<h1><a href= "home" ><?php echo $site->title()?></a></h1>
		
	</div>

<ul id="menu">


			<?php foreach($pages->visible() as $menu): ?>
					<nav>
						<li>
							<a <?php e($menu->isOpen(), ' class="active"') ?> href="<?php echo $menu->url() ?>" title="<?php echo $menu->title() ?>">
								<?php echo $menu->title() ?>
							</a>
						</li>
						


<!-- 						<li>
			      	
			      	<a href="<?php echo url('theme') ?>">
			          <?php echo $page->theme()->html() ?>   
			      	</a>
			      	
			      </li> -->

					</nav>
			<?php endforeach ?>
			</div>

</ul>

thank for you help!

This would be similar to using tags.

You can use the pluck() method to get all used “themes”:

$themes = page('articles')->children()->pluck('theme', ',', true); 

Then you can loop through these to build your menu.

As for filtering by these “themes”, check out this recipe: https://getkirby.com/docs/cookbook/tags

I try this, the used theme are display on my website :

			<?php foreach ($page->children('article')->pluck('theme', ',', true) as $themes): ?>

					<li>
		      	<a href="<?php echo url($page->url() . '/'. url::paramsToString(['theme' => $themes]))?>"> <?php echo html($themes)	?></a>
		      	
		      </li> 
		<?php endforeach ?>

but I don’t really get how to filter only the articles link to a theme and display only these articles.

In your controller (or template, if you are not using a controller):

$articles = $page->children()->visible();
if($theme = param('theme')) {
  $articles = $articles->filterBy('theme', $theme);
}

Note that children() does not take a parameter. So this:

$page->children('article')->pluck('theme', ',', true)

should be

$page->children()->pluck('theme', ',', true)