Would greatly appreciate help on this matter.  I've done lots of searching and reviewed many contrib modules but could not find an example/solution/help.  I want a content type called "blog" to use a specific template (i.e. node--bs_blog.tpl.php) which is in the folder of the "blog" module I'm working on.  In old Drupal 7 this code worked:

function bs_blog_theme($existing, $type, $theme, $path) {
  return array(
    'node__bs_blog' => array (
      'variables' => '',
      'template' => 'node--bs_blog',
      'base hook' => 'node',
      'path' => backdrop_get_path('module', 'bs_blog') . '/templates',
    ),
  );
}

but in the the latest version of Backdrop it's giving me all kinds of warnings and a final ERROR (see below if you want to view the full output).  I think it's a simple fix... just can't find an example to get me started.

=======

Full error output

=======

  • Warning: array_keys() expects parameter 1 to be array, string given in theme() (line 1068 of C:\wamp\www\backdrop_trash\core\includes\theme.inc).
  • Warning: Invalid argument supplied for foreach() in theme() (line 1068 of C:\wamp\www\backdrop_trash\core\includes\theme.inc).
  • Notice: Undefined index: #view_mode in template_preprocess_node() (line 197 of C:\wamp\www\backdrop_trash\core\modules\node\node.theme.inc).
  • Notice: Undefined index: #node in template_preprocess_node() (line 200 of C:\wamp\www\backdrop_trash\core\modules\node\node.theme.inc).
  • Notice: Trying to get property 'created' of non-object in template_preprocess_node() (line 203 of C:\wamp\www\backdrop_trash\core\modules\node\node.theme.inc).
  • Warning: date_timezone_set() expects parameter 1 to be DateTime, bool given in format_date() (line 2449 of C:\wamp\www\backdrop_trash\core\includes\common.inc).
  • Warning: date_format() expects parameter 1 to be DateTimeInterface, bool given in format_date() (line 2473 of C:\wamp\www\backdrop_trash\core\includes\common.inc).
  • Error: Call to a member function uri() on null in entity_uri() (line 756 of C:\wamp\www\backdrop_trash\core\modules\entity\entity.module).

 

Comments

You don't mention what url you're loading when you get the errors but I'm guessing it's an individual node. It's hard to know where to debug without seeing it firsthand. Plus I don't recall if you actually need to hook_theme or can you just put your template in the module. It's just extending node.tpl.php so it should get picked up automatically. See https://github.com/backdrop/backdrop/blob/1.x/core/modules/node/template... for what's needed.