Skip to content

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

Description

@naidim

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];
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions