I'm using https://www.drupal.org/project/restful module. I can sort base entity using annotation:
/**
* Class Things__1_0
* @package Drupal\restful_thing\Plugin\resource\node\thing
*
* @Resource(
* name = "things:1.0",
* resource = "things",
* label = "things",
* description = "Export the things with all authentication providers.",
* authenticationTypes = TRUE,
* authenticationOptional = TRUE,
* dataProvider = {
* "entityType": "node",
* "bundles": {
* "course"
* },
* "sort" = {
* "field_weight": "ASC"
* },
* },
* majorVersion = 1,
* minorVersion = 0
* )
*/
But when it comes to relationship, the related data isn't ordered the way I need.
Inside public_fields()
:
$public_fields['modules'] = array(
'property' => 'field_modules',
'resource' => array(
'name' => 'modules',
'fullView' => TRUE,
'majorVersion' => 1,
'minorVersion' => 0,
'dataProvider' => array( //here I'm trying to override dataProvider values
'sort' => array(
'field_weight' => 'ASC'
)
)
)
);
Is there any way to sort related data?
---edit---
I've also placed "sort" inside the annotation of the modules plugin, but It doesn't have effect too.