In my D7 template php I preprocessed some node variables as follows. It doesn't seem to be working in Backdrop. I went through the manual, but couldn't find an answer—is there a change in the way this should be structured? I actually have several of these, but this is the basic structure. 

function myTemplate_preprocess_page( & $variables, $hook ) {

  $myimg;

  if ( $variables[ 'is_front' ] != TRUE ) {

    if ( isset( $variables[ 'node' ]->field_image[ 'und' ][ 0 ][ 'uri' ] ) ) {

      $myimg = file_create_url( $variables[ 'node' ]->field_image[ 'und' ][ 0 ][ 'uri' ] );

    }

  }

}

All I end up with is my website url without the complete path to the image.

Most helpful answers

OK, obviously there is a problem, but it's really hard to pinpoint with the information you have provided. Check to be sure you are not duplicating the function name. Many themes provide implementations of template_preprocess_node, so it's easy to overlook this and duplicate the function name. 

Have you check the php error log? How about the Backdrop log?

template_preprocess_node() is a commonly used hook, and there is no reason why it should fail, unless you are doing something wrong.

template_preprocess_page() is not the same in Backdrop as it was in Drupal 7. In Backdrop, template_preprocess_page() is the equivalent to D7's template_preprocess_html().

Because of the layout API in Backdrop, there is no single equivalent to D7's template_preprocess_page(). You probably will need to implement template_preprocess_node(), which will fire whenever a node is viewed. $variables will contain the node object. You could also try implementing template_preprocess_layout__LAYOUT_MACHINE_NAME() but I'm not sure if the node is available there.

Comments

This is the part that doesn't seem to be working:

$variables[ 'node' ]->field_image[ 'und' ][ 0 ][ 'uri' ]

It's not able to access this value on a given nodes page. 

template_preprocess_page() is not the same in Backdrop as it was in Drupal 7. In Backdrop, template_preprocess_page() is the equivalent to D7's template_preprocess_html().

Because of the layout API in Backdrop, there is no single equivalent to D7's template_preprocess_page(). You probably will need to implement template_preprocess_node(), which will fire whenever a node is viewed. $variables will contain the node object. You could also try implementing template_preprocess_layout__LAYOUT_MACHINE_NAME() but I'm not sure if the node is available there.

Thank you for this, that gives me something to work with.

Anything I try with template_preprocess_node(), even an empty function white screens my site. Ahh this is frustrating. 

Do not call your function template_preprocess_node(). You must put it in your theme's template.php file, and call it THEME_NAME_preprocess_node().

If you use template_preprocess_node() literally, you will get a white screen because you are duplicating the function name!

Alternatively, you can place it ina custom module, and call it MY_MODULE_preprocess_node()

Sorry, I do replace template with my Theme Name, and it white screens my site.

OK, obviously there is a problem, but it's really hard to pinpoint with the information you have provided. Check to be sure you are not duplicating the function name. Many themes provide implementations of template_preprocess_node, so it's easy to overlook this and duplicate the function name. 

Have you check the php error log? How about the Backdrop log?

template_preprocess_node() is a commonly used hook, and there is no reason why it should fail, unless you are doing something wrong.

Right before I ran out the door earlier today, I say that I had a duplicate of the function :/

I got the code above working using MY_TEMPLATE_preprocess_node(). For some reason I had to change all of the isset instances to !empty, but it works now.

Thanks for your help…again:)

If I use theme_preprocess() I can get access to one of my node variables but not any of the others I need. This is weird.