16 lines
2.0 KiB
PHP
16 lines
2.0 KiB
PHP
<?php
|
|
/** Одинаковый SSR control в Yii и standalone PHP; переводы передаются явно. */
|
|
$themeLabels = $themeLabels ?? ['group' => 'Тема оформления', 'light' => 'Светлая тема', 'dark' => 'Тёмная тема'];
|
|
$themeInitial = isset($themeInitial) && $themeInitial === 'dark' ? 'dark' : 'light';
|
|
$themeEscape = static fn(string $value): string => htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
|
?>
|
|
<div class="theme-switch" role="group" aria-label="<?= $themeEscape($themeLabels['group']) ?>">
|
|
<button type="button" data-theme-choice="light" aria-label="<?= $themeEscape($themeLabels['light']) ?>" title="<?= $themeEscape($themeLabels['light']) ?>" aria-pressed="<?= $themeInitial === 'light' ? 'true' : 'false' ?>">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M10 3.33333V2.5M14.7141 5.28571L15.3033 4.69645M16.6667 10H17.5M14.7141 14.7143L15.3033 15.3035M10 16.6667V17.5M5.28605 14.7139L4.6968 15.3032M3.33333 10H2.5M5.28605 5.28605L4.6968 4.6968M14.1667 10C14.1667 12.3012 12.3012 14.1667 10 14.1667C7.69881 14.1667 5.83333 12.3012 5.83333 10C5.83333 7.69881 7.69881 5.83333 10 5.83333C12.3012 5.83333 14.1667 7.69881 14.1667 10Z" stroke="currentColor" stroke-linecap="square"/></svg>
|
|
</button>
|
|
<button type="button" data-theme-choice="dark" aria-label="<?= $themeEscape($themeLabels['dark']) ?>" title="<?= $themeEscape($themeLabels['dark']) ?>" aria-pressed="<?= $themeInitial === 'dark' ? 'true' : 'false' ?>">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M11.1504 3.43439C11.4811 4.1663 11.667 4.97841 11.667 5.8338C11.6668 9.05529 9.05455 11.6668 5.83301 11.6668C4.97779 11.6668 4.16636 11.4809 3.43457 11.1502C3.97969 14.2838 6.71044 16.6668 10 16.6668C13.6819 16.6668 16.667 13.6817 16.667 9.99981C16.6669 6.71047 14.2838 3.97958 11.1504 3.43439Z" stroke="currentColor" stroke-linejoin="round"/></svg>
|
|
</button>
|
|
</div>
|
|
<script>if(window.ZoomzillaTheme)window.ZoomzillaTheme.refresh();</script>
|