I’m trying to upgrade to Timber 2.x and keep running into errors with template locations.
I switched from Timber::$locations[] =
to using the timber/locations
filter; At first it didn’t like adding a string
to $paths, so they’re index 0 arrays, but now I’m getting:
foreach() argument must be of type array|object, null given in timber/timber/src/Loader.php on line 289.
Here’s a dump of my $paths
(with the full local path omitted):
<code>array (size=9)
'__main__' =>
array (size=7)
0 => string 'theme-child/views' (length=87)
1 => string 'theme/views' (length=76)
2 => string 'theme-child/' (length=82)
3 => string 'theme-child/views/' (length=88)
4 => string 'theme/' (length=71)
5 => string 'theme/views/' (length=77)
0 =>
array (size=1)
0 => string 'mu-plugins/my-libutils/views' (length=84)
1 =>
array (size=1)
0 => string 'plugins/my-content-block/views' (length=86)
2 =>
array (size=1)
0 => string 'plugins/my-item-scheduling/views' (length=88)
3 =>
array (size=1)
0 => string 'plugins/my-location/views' (length=81)
</code>
<code>array (size=9)
'__main__' =>
array (size=7)
0 => string 'theme-child/views' (length=87)
1 => string 'theme/views' (length=76)
2 => string 'theme-child/' (length=82)
3 => string 'theme-child/views/' (length=88)
4 => string 'theme/' (length=71)
5 => string 'theme/views/' (length=77)
0 =>
array (size=1)
0 => string 'mu-plugins/my-libutils/views' (length=84)
1 =>
array (size=1)
0 => string 'plugins/my-content-block/views' (length=86)
2 =>
array (size=1)
0 => string 'plugins/my-item-scheduling/views' (length=88)
3 =>
array (size=1)
0 => string 'plugins/my-location/views' (length=81)
</code>
array (size=9)
'__main__' =>
array (size=7)
0 => string 'theme-child/views' (length=87)
1 => string 'theme/views' (length=76)
2 => string 'theme-child/' (length=82)
3 => string 'theme-child/views/' (length=88)
4 => string 'theme/' (length=71)
5 => string 'theme/views/' (length=77)
0 =>
array (size=1)
0 => string 'mu-plugins/my-libutils/views' (length=84)
1 =>
array (size=1)
0 => string 'plugins/my-content-block/views' (length=86)
2 =>
array (size=1)
0 => string 'plugins/my-item-scheduling/views' (length=88)
3 =>
array (size=1)
0 => string 'plugins/my-location/views' (length=81)