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

Fix bug when retrieving field values #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

njt1982
Copy link

@njt1982 njt1982 commented Oct 25, 2019

This seems to fix #22

Field Collections and Text now seem to work...

For this query:

query {
  node(nid:"6") {
    nid
    title
    field_teaser_text {
      value
      format
    }
  }
}

Before:

  "data": {
    "node": [
      {
        "nid": "6",
        "title": "EXAMPLE",
        "field_teaser_text": {
          "value": null,
          "format": null
        }
      }
    ]
  }

Now:

  "data": {
    "node": [
      {
        "nid": "6",
        "title": "EXAMPLE",
        "field_teaser_text": {
          "value": "Some teaser text value",
          "format": "filtered_html"
        }
      }
    ]
  }

@njt1982
Copy link
Author

njt1982 commented Oct 25, 2019

One issue... if I do:

query {
  node(nid:"6") {
    nid
    title
    field_topics {
      tid
    } 
  }
}

This field has 7 topics, but obviously we're only returning the first one?

  "data": {
    "node": [
      {
        "nid": "6",
        "title": "EXAMPLE",
        "field_topics": {
          "tid": "16"
        }
      }
    ]
  }

@olragon
Copy link
Owner

olragon commented Oct 26, 2019

@njt1982 first, great work

I belive that we can access raw value with ->raw()

$wrapper->body->raw();

Very good article about entity metadata wrapper Death to Field Arrays!

@njt1982
Copy link
Author

njt1982 commented Oct 26, 2019

I think I tried ->raw() and it returned the same single value instead of the raw field properties... I’ll have to try it again 😉

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

Successfully merging this pull request may close these issues.

Field Collections working?
2 participants