Skip to main content
improved grammar and spelling
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

I'm on D7. I have a content-type, that content type haswith a Long text and summary field "Long text and summary". In the node view display, it is set to "summary or trimmed"to show as Summary or trimmed.

Now I have a module. In that module, I getgets all the nodenodes of that specific content-type. For that, I first get the node's nids and then load them using "node_load_multiple" type.

Anyway, ifHow do I now var dump one nodeprogrammatically get the trimmed value of that type it does have a summary key and a description keyfield? Using var_dump(), I get the following output.

  ["field_description"]=>
  array(1) {
    ["und"]=>
    array(1) {
      [0]=>
      array(5) {
        ["value"]=>
        string(5763) "<p>Test user DescriptionTest</p>"
        ["summary"]=>
        string(0) ""
        ["format"]=>
        string(9) "full_html"
        ["safe_value"]=>
        string(5764) "<p>Test user Description</p>
"p>"
        ["safe_summary"]=>
        string(0) ""
      }
    }

the description content is much longer in reality. Anyway, I can't see where I could get the trimmed value.

How do I get the trimmet valu?

I'm on D7. I have a content-type, that content type has a field "Long text and summary". In the display, it is set to "summary or trimmed".

Now I have a module. In that module, I get all the node of that specific content-type. For that, I first get the node's nids and then load them using "node_load_multiple".

Anyway, if I now var dump one node of that type it does have a summary key and a description key

  ["field_description"]=>
  array(1) {
    ["und"]=>
    array(1) {
      [0]=>
      array(5) {
        ["value"]=>
        string(5763) "<p>Test user DescriptionTest</p>"
        ["summary"]=>
        string(0) ""
        ["format"]=>
        string(9) "full_html"
        ["safe_value"]=>
        string(5764) "<p>Test user Description</p>
"
        ["safe_summary"]=>
        string(0) ""
      }
    }

the description content is much longer in reality. Anyway, I can't see where I could get the trimmed value.

How do I get the trimmet valu?

I have a content type with a Long text and summary field. In the node view display, it is set to to show as Summary or trimmed.

I have a module that gets all the nodes of that content type.

How do I programmatically get the trimmed value of that field? Using var_dump(), I get the following output.

  ["field_description"]=>
  array(1) {
    ["und"]=>
    array(1) {
      [0]=>
      array(5) {
        ["value"]=>
        string(5763) "<p>Test user DescriptionTest</p>"
        ["summary"]=>
        string(0) ""
        ["format"]=>
        string(9) "full_html"
        ["safe_value"]=>
        string(5764) "<p>Test user Description</p>"
        ["safe_summary"]=>
        string(0) ""
      }
    }
Source Link
xotix
  • 149
  • 7

Access trimmed description in module

I'm on D7. I have a content-type, that content type has a field "Long text and summary". In the display, it is set to "summary or trimmed".

Now I have a module. In that module, I get all the node of that specific content-type. For that, I first get the node's nids and then load them using "node_load_multiple".

Anyway, if I now var dump one node of that type it does have a summary key and a description key

  ["field_description"]=>
  array(1) {
    ["und"]=>
    array(1) {
      [0]=>
      array(5) {
        ["value"]=>
        string(5763) "<p>Test user DescriptionTest</p>"
        ["summary"]=>
        string(0) ""
        ["format"]=>
        string(9) "full_html"
        ["safe_value"]=>
        string(5764) "<p>Test user Description</p>
"
        ["safe_summary"]=>
        string(0) ""
      }
    }

the description content is much longer in reality. Anyway, I can't see where I could get the trimmed value.

How do I get the trimmet valu?