Yoast_Feature_Toggles::sort_toggles_callback()protectedYoast 1.0

Callback for sorting feature toggles by their order.

{@internal Once the minimum PHP version goes up to PHP 7.0, the logic in the function can be replaced with the spaceship operator <=>.}

Метод класса: Yoast_Feature_Toggles{}

Хуков нет.

Возвращает

int. An integer less than, equal to, or greater than zero indicating respectively that feature A is considered to be less than, equal to, or greater than feature B.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->sort_toggles_callback( $feature_a, $feature_b );
$feature_a(Yoast_Feature_Toggle) (обязательный)
Feature A.
$feature_b(Yoast_Feature_Toggle) (обязательный)
Feature B.

Код Yoast_Feature_Toggles::sort_toggles_callback() Yoast 23.5

protected function sort_toggles_callback( Yoast_Feature_Toggle $feature_a, Yoast_Feature_Toggle $feature_b ) {
	return ( $feature_a->order - $feature_b->order );
}