Search code examples
cakephppluginspaginator

CakePHP Paginator->sort(__d( does not work


I have a plugin translated with i18n, In index.ctp there is the paginator sort:

<?php echo $this->Paginator->sort(__d('item', 'item_layout_id')); ?>

When I try to sort the columns, they are not put in order.

This is the url with i18n:

index/sort:Layout/direction:desc

instead of:

index/sort:item_layout_id/direction:desc

How do I solve the problem?


Solution

  • The way you are using the sort method of paginator helper is wrong, just try like this.

    <?php $this->Paginator->sort('item_layout_id', __('item')); ?>
    

    or

    <?php $this->Paginator->sort('item_layout_id', __d('your_domain_name', 'item')); ?>
    

    For more details, check here.