WP_Customize_Widgets::_sort_name_callback()protectedWP 3.9.0

Naturally orders available widgets by name.

Method of the class: WP_Customize_Widgets{}

No Hooks.

Return

Int. Reorder position for the current widget comparison.

Usage

// protected - for code of main (parent) or child class
$result = $this->_sort_name_callback( $widget_a, $widget_b );
$widget_a(array) (required)
The first widget to compare.
$widget_b(array) (required)
The second widget to compare.

Changelog

Since 3.9.0 Introduced.

WP_Customize_Widgets::_sort_name_callback() code WP 6.5.2

protected function _sort_name_callback( $widget_a, $widget_b ) {
	return strnatcasecmp( $widget_a['name'], $widget_b['name'] );
}