Skip to content
Snippets Groups Projects
Commit 9f526c51 authored by Xebax's avatar Xebax
Browse files

REST API: sort the classes before adding them to Restler.

The Restler API Explorer shows the classes in the order they are added
and it's a mess if they are not sorted.
parent f6eac2b6
No related branches found
No related tags found
No related merge requests found
......@@ -65,6 +65,8 @@ $api->r->addAPIClass('Luracast\\Restler\\Explorer');
$api->r->setSupportedFormats('JsonFormat', 'XmlFormat');
$api->r->addAuthenticationClass('DolibarrApiAccess','');
$listofapis = array();
$modulesdir = dolGetModulesDirs();
foreach ($modulesdir as $dir)
{
......@@ -117,7 +119,7 @@ foreach ($modulesdir as $dir)
if (class_exists($classname))
{
dol_syslog("Found API classname=".$classname);
$api->r->addAPIClass($classname);
$listofapis[] = $classname;
}
}
}
......@@ -128,6 +130,14 @@ foreach ($modulesdir as $dir)
}
}
// Sort the classes before adding them to Restler. The Restler API Explorer
// shows the classes in the order they are added and it's a mess if they are
// not sorted.
sort($listofapis);
foreach ($listofapis as $classname)
{
$api->r->addAPIClass($classname);
}
// TODO If not found, redirect to explorer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment