Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return fields not found in node (but are) #1049

Open
naidim opened this issue Dec 21, 2018 · 0 comments
Open

Return fields not found in node (but are) #1049

naidim opened this issue Dec 21, 2018 · 0 comments

Comments

@naidim
Copy link

naidim commented Dec 21, 2018

Trying to expose the 'metatags' field added to nodes from the Metatag module, which is accessible via node_load and RESTful simply says "The property metatags could not be found in node" even though it exposes just fine via Services or Contentasjson modules. Is there something special in RESTful I'm missing or is it purposely filtering that field?

Here's what I've done to expose the field (and I'm sure its completely wrong, but it works)

protected function publicFields() {
...
  // Expose Metatags
  $public_fields['metatags'] = array(
    'property' => 'nid',
    'process_callbacks' => array(
      array($this, 'getMetatags'),
    )
  );
...
public function getMetatags($value) {
  $node = node_load($value);
  return $node->metatags[$node->language];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant