Score:0

How to get the field data

us flag

Hi i'm using entityreference, i hava an content type"test" that contain a field that refer to categorie and this categorie contain a field_theme also referenced to another content type theme_test. On Theme_test i have a field entityreference that refer to Criter and this last is saved on Test Finally on an other field let's name it recap.

array(19) {
  ["#theme"]=>
  string(5) "field"
  ["#weight"]=>
  string(1) "6"
  ["#title"]=>
  string(18) "suivi pédagogique"
  ["#access"]=>
  bool(true)
  ["#label_display"]=>
  string(5) "above"
  ["#view_mode"]=>
  string(4) "full"
  ["#language"]=>
  string(3) "und"
  ["#field_name"]=>
  string(11) "field_suivi"
  ["#field_type"]=>
  string(15) "entityreference"
  ["#field_translatable"]=>
  string(1) "0"
  ["#entity_type"]=>
  string(4) "node"
  ["#bundle"]=>
  string(4) "test"
  ["#object"]=>
  object(stdClass)#80 (35) {
    ["vid"]=>
    string(3) "500"
    ["uid"]=>
    string(1) "0"
    ["title"]=>
    string(25) "test1_2021-08-20 16:02:29"
    ["log"]=>
    string(0) ""
    ["status"]=>
    string(1) "1"
    ["comment"]=>
    string(1) "1"
    ["promote"]=>
    string(1) "0"
    ["sticky"]=>
    string(1) "0"
    ["nid"]=>
    string(8) "10485403"
    ["type"]=>
    string(4) "test"
    ["language"]=>
    string(3) "und"
    ["created"]=>
    string(10) "1629468149"
    ["changed"]=>
    string(10) "1629468149"
    ["tnid"]=>
    string(1) "0"
    ["translate"]=>
    string(1) "0"
    ["revision_timestamp"]=>
    string(10) "1629468149"
    ["revision_uid"]=>
    string(1) "1"
    ["field_id_externe"]=>
    array(0) {
    }
    ["field_categories"]=>
    array(1) {
      ["und"]=>
      array(1) {
        [0]=>
        array(3) {
          ["target_id"]=>
          string(2) "20"
          ["entity"]=>
          object(stdClass)#96 (30) {
            ["vid"]=>
            string(2) "20"
            ["uid"]=>
            string(1) "1"
            ["title"]=>
            string(7) "r489_1A"
            ["log"]=>
            string(0) ""
            ["status"]=>
            string(1) "1"
            ["comment"]=>
            string(1) "1"
            ["promote"]=>
            string(1) "0"
            ["sticky"]=>
            string(1) "0"
            ["nid"]=>
            string(2) "20"
            ["type"]=>
            string(9) "categorie"
            ["language"]=>
            string(3) "und"
            ["created"]=>
            string(10) "1625752758"
            ["changed"]=>
            string(10) "1629454614"
            ["tnid"]=>
            string(1) "0"
            ["translate"]=>
            string(1) "0"
            ["revision_timestamp"]=>
            string(10) "1629454614"
            ["revision_uid"]=>
            string(1) "1"
            ["field_famille"]=>
            array(0) {
            }
            ["field_ut"]=>
            array(0) {
            }
            ["field_id_externe"]=>
            array(1) {
              ["und"]=>
              array(1) {
                [0]=>
                array(3) {
                  ["value"]=>
                  string(7) "r489-1A"
                  ["format"]=>
                  NULL
                  ["safe_value"]=>
                  string(7) "r489-1A"
                }
              }
            }
            ["field_theme"]=>
            array(1) {
              ["und"]=>
              array(2) {
                [0]=>
                array(1) {
                  ["target_id"]=>
                  string(8) "10485206"
                }
                [1]=>
                array(1) {
                  ["target_id"]=>
                  string(8) "10485236"
                }
              }
            }

I want to display Criter by theme on node "test" programmatically but idon't know how, i google it but no one have some idea for Three level of referenced entity.

Thanks to All :)

shelane avatar
cn flag
What version of Drupal are you using?
Amine avatar
us flag
I'm using Drupal7 @shelane
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.