Filter incomplete translations from language switch by field value in site

I have a field in my panel which an indicator translation complete (taal_actief)
I made a language dropdown and wants to show only the languages that are complete.
I tried:
$site->taal_actief()->translation()->html()
But the value is always the value of the current language. So in a complete language I get a dropdown with all languages.

Is it possible to get the different values? It is not a translation (like daynames / monthnames).

Assuming you are using a switch similar to the below, you can check if the field value is true:

<nav class="languages">
  <ul>
    <?php foreach($kirby->languages() as $language): ?>
      <?php if ($site->content($language->code())->get('taal_active')->toBool() === true): ?>
        <li<?php e($kirby->language() == $language, ' class="active"') ?>>
          <a href="<?= $page->url($language->code()) ?>" hreflang="<?php echo $language->code() ?>">
            <?= html($language->name()) ?>
          </a>
        </li>
       <?php endif ?>
    <?php endforeach ?>
  </ul>
</nav>
1 Like

This is very useful! Also in situations for fallback to other language content!