Reference

Guide

$language->code()

Returns the language code/id.

$language->code(): string

Return type

string

Example

<ul>
  <?php foreach($site->languages() as $language): ?>
  <li>
    <a href="<?= $language->url() ?>">
      <?= $language->code() ?>
    </a>
  </li>
  <?php endforeach ?>
</ul>

Source code

kirby/src/Cms/Language.php#L123