These are chat archives for luyadev/luya

12th
Oct 2016
seflova
@seflova
Oct 12 2016 17:56
Hello, How do I insert a widget LanguageSwitcher to the views / layouts / main.php.
Basil
@nadar
Oct 12 2016 18:10
I am going to write a guide about, but just call the class -> https://luya.io/api/luya-cms-widgets-LanguageSwitcher
Basil
@nadar
Oct 12 2016 18:51

to call the language switch run:

luya\cms\widgets\LanguageSwitcher::widget();

this will throw an exception, as the widget will look for a view file, create this view file with the following content:
<div class="langnav">
  <ul class="langnav__list">
  <?php foreach($items as $item): ?>
      <li class="langnav__item">
          <a class="langnav__link <?php if ($item['isCurrent']): ?>langnav__link--current<?endif; ?>" href="<?php echo $item['href']; ?>"><?php echo $item['language']['short_code']; ?></a>
      </li>
  <?php endforeach; ?>
  </ul>
</div>