Prior to Backdrop 1.8.0, calls to theme('image', $variables)
required that the path to an image be specified using $variables['uri']
. This was confusing because both URIs like public://example.png
and paths like core/favicon.ico
were allowed. Backdrop now accepts either "path" or "uri" properties. This makes porting modules from Drupal 7 easier, as it only supported the "path" property.
Backdrop 1.7 and earlier:
// Only uri is supported, even on path-based parameters.
$image1 = theme('image', array('uri' => 'core/misc/feed.png', 'width' => 16, 'height' => 16));
$image2 = theme('image', array('uri' => 'public://feed.png', 'width' => 16, 'height' => 16));
Backdrop 1.8 and later:
// Either path or uri is supported.
$image = theme('image', array('path' => 'core/misc/feed.png', 'width' => 16, 'height' => 16));
$image2 = theme('image', array('uri' => 'public://feed.png', 'width' => 16, 'height' => 16));
Note that Backdrop does not enforce paths to be relative paths or URIs to be strictly URIs. Internally they are treated the same. See template_preprocess_image() and theme_image().
Introduced in branch:
1.x
Introduced in version:
1.8.0
Impacts:
Module developers
Theme developers
Related Github Issues: