Nodes are not displaying on my site. I'm trying to debug this but I'm not having much luck.

  • I am using a custom theme but I changed the theme back to easystreet3 and I'm still getting the same issue.
  • I checked #2179241: Node display but I already have window.localStorage.clear() enabled.
  • I have set the display mode for pages on my site.
  • I have cleared the caches on my Drupal site and reset the iOS simulator, which I am using to debug, several times.

I have made a link to node 1 on my site like this:

    content['node1'] = {
      theme: 'button_link',
      text: 'Node1',
      path: 'node/1',
    };

When I visit the page, I see the title but no node content. To debug further, I tried making the page its own function like this:

function mymodule_node1_page() {
  try {
    node_load(1, {
  success:function(node){
    alert("Loaded " + node.title + node.content);
  }
});
    node_page_view(1);
  }
  catch (error) { console.log('mymodule_node1_page - ' + error); }
}

When I do this, node.title and node.content are displayed correctly in the alert box, but there is no actual content on the page.

How can I debug this further?

Comments

tyler.frankenstein’s picture

Status: Active » Postponed (maintainer needs more info)

If you do a GET on ?q=drupalgap/node/123.json, is there a language code reported on the node? If so, is there any matching language code attached to each field on the node? I'm guessing this is a multi-lingual issue. By default DrupalGap tries to use the language code specified on the node, and then uses that language code to load the values of each field. If the field doesn't have that language code defined, it falls back to 'und'.

ptmkenny’s picture

Status: Postponed (maintainer needs more info) » Active

Here's the result of GET ?q=drupalgap/node/11.json

{
    "body": {
        "und": [
            {
                "format": "full_html",
                "safe_summary": "",
                "safe_value": "<h2>The Golden Rule</h2>page content",
                "summary": "",
                "value": "<h2>The Golden Rule</h2>page content"
            }
        ]
    },
    "changed": "1340956696",
    "comment": "1",
    "created": "1334660968",
    "current_revision_id": "64",
    "data": "a:6:{s:7:\"overlay\";i:0;s:20:\"l10n_client_disabled\";b:0;s:34:\"user_relationships_ui_auto_approve\";a:0:{}s:34:\"user_relationship_mailer_send_mail\";b:1;s:17:\"mimemail_textonly\";i:0;s:14:\"geoip_location\";a:11:{s:12:\"country_code\";s:0:\"\";s:7:\"country\";s:0:\"\";s:6:\"region\";s:0:\"\";s:11:\"region_code\";s:0:\"\";s:4:\"city\";s:0:\"\";s:3:\"zip\";s:0:\"\";s:8:\"latitude\";N;s:9:\"longitude\";N;s:9:\"time_zone\";s:0:\"\";s:10:\"ip_address\";s:15:\"106.151.184.209\";s:9:\"timestamp\";i:1425050013;}}",
    "is_current": true,
    "is_pending": false,
    "language": "en-US",
    "log": "",
    "metatags": [],
    "name": "patrick",
    "nid": "11",
    "num_revisions": "3",
    "path": "http://mysite.com/en/rules",
    "picture": "0",
    "promote": "0",
    "rdf_mapping": {
        "body": {
            "predicates": [
                "content:encoded"
            ]
        },
        "changed": {
            "callback": "date_iso8601",
            "datatype": "xsd:dateTime",
            "predicates": [
                "dc:modified"
            ]
        },
        "comment_count": {
            "datatype": "xsd:integer",
            "predicates": [
                "sioc:num_replies"
            ]
        },
        "created": {
            "callback": "date_iso8601",
            "datatype": "xsd:dateTime",
            "predicates": [
                "dc:date",
                "dc:created"
            ]
        },
        "last_activity": {
            "callback": "date_iso8601",
            "datatype": "xsd:dateTime",
            "predicates": [
                "sioc:last_activity_date"
            ]
        },
        "name": {
            "predicates": [
                "foaf:name"
            ]
        },
        "rdftype": [
            "foaf:Document"
        ],
        "title": {
            "predicates": [
                "dc:title"
            ]
        },
        "uid": {
            "predicates": [
                "sioc:has_creator"
            ],
            "type": "rel"
        }
    },
    "revision_moderation": true,
    "revision_timestamp": "1336574832",
    "revision_uid": "2",
    "status": "1",
    "sticky": "0",
    "title": "Rules",
    "tnid": "11",
    "translate": "0",
    "type": "page",
    "uid": "2",
    "vid": "64"
}

So it looks like the node has a language of en-US but the body field value is und. I believe this is the standard configuration when using i18n node translation (which I am) instead of entity translation.

I tried accessing the page both with Drupal.settings.language_default set to 'und' and 'en-US', but both times it returns a blank page, although the content is printed to the screen in the alert dialog box after node_load of node.content.