3468180: Fix undefined array key 'view_mode' when a custom block renders a block_content directly
3468180: Fix issue where we receive warning for undefined array key 'view_mode' when a custom block renders a block_content directly.
Since we are already looking to $variables['elements']['content']
for #block_content
, we might as well get the #view_mode
there too.
Closes #3468180
Merge request reports
Activity
added 151 commits
-
f58cc9e3...cec21638 - 150 commits from branch
project:11.x
- 51949464 - Merge branch '11.x' into 3468180-undefined-view-mode
-
f58cc9e3...cec21638 - 150 commits from branch
added 53 commits
-
9a2a6a61...ba3a786b - 51 commits from branch
project:11.x
- 6645c66c - Merge branch '11.x' into 3468180-undefined-view-mode
- 047c5d5b - Add missing typehints
-
9a2a6a61...ba3a786b - 51 commits from branch
added 151 commits
-
047c5d5b...2014ae98 - 150 commits from branch
project:11.x
- a5a7a510 - Merge branch '11.x' into 3468180-undefined-view-mode
-
047c5d5b...2014ae98 - 150 commits from branch
119 119 $block_content = $variables['elements']['content']['#block_content'] ?? NULL; 120 120 if ($block_content instanceof BlockContentInterface) { 121 121 $bundle = $content['#block_content']->bundle(); 122 $view_mode = strtr($variables['elements']['#configuration']['view_mode'], '.', '_'); 122 $view_mode = strtr($variables['elements']['content']['#view_mode'], '.', '_'); If we have previous place where
view_mode
is store, why not to have a backward compatibility?122 $view_mode = strtr($variables['elements']['content']['#view_mode'], '.', '_'); 122 $configuration_view_mode = $variables['elements']['#configuration']['view_mode'] ?? null; 123 $content_view_mode = $variables['elements']['content']['#view_mode'] ?? null; 124 $view_mode = strtr($configuration_view_mode ?? $content_view_mode;, '.', '_'); changed this line in version 18 of the diff
added 23 commits
-
ca85927e...38c850c4 - 22 commits from branch
project:11.x
- c5b56031 - Merge branch '11.x' into 3468180-undefined-view-mode
-
ca85927e...38c850c4 - 22 commits from branch
Please register or sign in to reply