Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is this: "->" in Drupal?

Tags:

php

drupal

I am running into this -> in Drupal and cant find any docs on it.

I am using it like this print $node->content['field_pr_link'];

is it a Drupal thing or PHP?

like image 908
user845040 Avatar asked Dec 16 '22 11:12

user845040


2 Answers

It's PHP. You are using it to access the content field on the node object.

See http://php.net/manual/en/language.oop5.php

like image 59
stevebot Avatar answered Jan 05 '23 00:01

stevebot


That is the PHP "Operator Object". It is very poorly documented in the PHP manual. It allows you to reference the variables, constants, and methods of an object.

$a = $ObjectInstance->var; # get variable or constant
$ObjectInstance->var2 = "string"; # set variable
$ObjectInstance->method(); # invoke a method.
like image 25
Mark Avatar answered Jan 05 '23 00:01

Mark