<?php
$translate = $this->plugin('translate');
$escape = $this->plugin('escapeHtml');
?>
<form class="sorting" action="">
    <?php echo $this->queryToHiddenInputs(['sort_by', 'sort_order', 'sort_by_default', 'sort_order_default']); ?>
    <select name="sort_by" aria-label="<?php echo $translate('Sort by'); ?>">
    <?php foreach($sortConfig as $sortBy => $label): ?>
        <option value="<?php echo $escape($sortBy); ?>"<?php echo ($sortByQuery === $sortBy) ? ' selected' : ''; ?>><?php echo $escape($label); ?></option>
    <?php endforeach; ?>
    </select>
    <select name="sort_order" aria-label="<?php echo $translate('Sort order'); ?>">
        <option value="asc"<?php echo ($sortOrderQuery === 'asc') ? ' selected' : ''; ?>><?php echo $translate('Ascending'); ?></option>
        <option value="desc"<?php echo ($sortOrderQuery === 'desc') ? ' selected' : ''; ?>><?php echo $translate('Descending'); ?></option>
    </select>
    <button type="submit"><?php echo $translate('Sort'); ?></button>
</form>
