Understanding <? Php print $ node & # 8594; content ['body'] ['# value'];?> in Drupal

Sorry, this is really a noob question ...

When I want to print part of the $ content array in node.tpl.php (for example), I will use something like <?php print $node->content['body']['#value']; ?>

I just want to understand what it is ->. Presumably this means that $nodeis something other than a regular array? (Otherwise it will be $node['content']['body']['#value'])

Greetings.

+3
source share
3 answers

$ node is an object, and content is one of its properties that contains an array.

If the content is also an object, it will be

$ node -> content-> body, etc.

+8
source

, , devel . devel

<?php dpm($node); ?> 

, . .

+5

You should consider installing Theme Developer. With it, you can click on the elements of your page, and you will get a debug list of all the variables associated with Drupal or Views that may be available by your code.

So, you can explore $ content and all its fields ...

+1
source

Source: https://habr.com/ru/post/1751029/


All Articles