Tribe__Tickets__REST__V1__Attendee_Repository::order_by( string $order_by, string $order = 'DESC' )
Overrides the base order_by method to map and convert some REST API specific criteria.
Contents
Parameters
- $order_by
-
(string) (Required) The post field, custom field or alias key to order posts by.
- $order
-
(string) (Optional) The order direction; optional; shortcut for the
ordermethod; defaults toDESC.Default value: 'DESC'
Return
($this)
Source
File: src/Tribe/REST/V1/Attendee_Repository.php
public function order_by( $order_by, $order = 'DESC' ) {
$map = array(
'date' => 'date',
'relevance' => 'relevance',
'id' => 'id',
'include' => 'meta_value_num',
'title' => 'title',
'slug' => 'name',
);
// if ( 'include' === $order_by ) {
// @todo review when one meta key is unified
// }
$converted_order_by = Tribe__Utils__Array::get( $map, $order_by, false );
if ( empty( $converted_order_by ) ) {
return $this;
}
$this->decorated->order_by( $converted_order_by, $order );
return $this;
}