By dawehner on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.0.x
Introduced in version:
8.0.0-beta5
Issue links:
Description:
Manually creating a image formatter now requires a URL instead of a path. The URL must be an Drupal\Core\Url. Those can either be requested from an entity when working with one (see example below), or by creating one with Url::fromRoute() or Url::fromUri().
Before
:
$element = [
'#theme' => 'image_formatter',
'#image_style' => 'name_of_image_style',
'#item' => $item,
'#path' => [
'path' => $entity->getSystemPath(),
'options' => [],
],
];
After
$element = [
'#theme' => 'image_formatter',
'#image_style' => 'name_of_image_style',
'#item' => $item,
'#url' => $node->urlInfo(),
];
Impacts:
Module developers
Themers