drupal 7 - Access $block inside Block body field that has PHP evaluator enabled
In template.php, I've added a variable to$block
via$vars['block']->member_login_url
, insidetheme_preprocess_block
.
I can access this variable in theblock.tpl.php
by:<?php print $block->member_login_url; ?>
, but I would like to access it in the GUI block edit screen in Drupal (screenshot below of where I'm getting undefined variable errors).
The body field is using a text type with 'PHP Evaluator' enabled, but for some reason I can't figure out how to access Drupal variables, or block variables.
Answer
Solution:
I am not sure why you are assigning the value using object notation. I would have used
$vars['block']['member_login_url'] = blah
and then access the variable using$member_login_url
in the tpl file, but you can output the available variables in the template using the php functionget_defined_vars()