| @@ 93-106 (lines=14) @@ | ||
| 90 | * @return array |
|
| 91 | * The sort arguments if any exposed sorts are available. |
|
| 92 | */ |
|
| 93 | protected function getSortArguments(DisplayPluginInterface $display, $id) { |
|
| 94 | $sorts = array_filter($display->getOption('sorts') ?: [], function ($sort) { |
|
| 95 | return $sort['exposed']; |
|
| 96 | }); |
|
| 97 | return $sorts ? [ |
|
| 98 | 'sortDirection' => [ |
|
| 99 | 'type' => 'ViewSortDirection', |
|
| 100 | 'default' => 'asc', |
|
| 101 | ], |
|
| 102 | 'sortBy' => [ |
|
| 103 | 'type' => StringHelper::camelCase($id, 'sort', 'by'), |
|
| 104 | ], |
|
| 105 | ] : []; |
|
| 106 | } |
|
| 107 | ||
| 108 | /** |
|
| 109 | * Helper function to return the filter argument if applicable. |
|
| @@ 52-65 (lines=14) @@ | ||
| 49 | * @return array |
|
| 50 | * The sort arguments if any exposed sorts are available. |
|
| 51 | */ |
|
| 52 | protected function getSortArguments(DisplayPluginInterface $display, $id) { |
|
| 53 | $sorts = array_filter($display->getOption('sorts') ?: [], function ($sort) { |
|
| 54 | return $sort['exposed']; |
|
| 55 | }); |
|
| 56 | return $sorts ? [ |
|
| 57 | 'sortDirection' => [ |
|
| 58 | 'type' => 'ViewSortDirection', |
|
| 59 | 'default' => 'asc', |
|
| 60 | ], |
|
| 61 | 'sortBy' => [ |
|
| 62 | 'type' => StringHelper::camelCase($id, 'sort', 'by'), |
|
| 63 | ], |
|
| 64 | ] : []; |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * Helper function to return the filter argument if applicable. |
|