0

I am using the Services module and Drupalgap, which provides a service endpoint by default. I want to make changes to the available services on the drupalgap endpoint, and I manage configuration on my site using Features, so I want to override the endpoint provided by Drupalgap.

However, if I check the box in the Features UI, it doesn't add the drupalgap endpoint because it's already "owned" by the Drupalgap module.

I dug into the code and the Drupalgap endpoint is provided by drupalgap_default_services_endpoint(). I tried adding the exported service configuration in mymodule_drupalgap_default_services_endpoint() and clearing the cache but it doesn't look like this gets picked up.

So, how can I override a service endpoint in a module's code with my own code for that endpoint? If there's no way to do it, I guess I can cut and paste the exported, updated code over the endpoint in the Drupalgap module, but that seems like the wrong approach.

  • Maybe change the weight of your module to be heavier than DrupalGap, then in your implementation of hook_default_services_endpoint() call drupalgap_default_services_endpoint() to retrieve its values, then make modifications and return them. – tyler.frankenstein Mar 4 '15 at 9:36
0

I found a smooth way to do this without overriding anything.

  1. Create a new services endpoint by cloning the Drupalgap endpoint.
  2. Add the new endpoint to a feature to keep it in code.
  3. In Drupalgap's settings.js, change the endpoint to the new custom endpoint. The relevant line is:

    // Default Services Endpoint Path

    Drupal.settings.endpoint = 'drupalgap';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.