Problem/Motivation
Steps to reproduce
Given that a paragraph has a Background Image
When updating to Varbase ~10.0
and Varbase Media ~10.0
and saving the page
Then the following fatal error shows up
The website encountered an unexpected error. Please try again later.
Error: Call to a member function buildUrl() on null in varbase_bootstrap_paragraphs_preprocess_paragraph() (line 50 of modules/contrib/varbase_bootstrap_paragraphs/varbase_bootstrap_paragraphs.module).
call_user_func_array('varbase_bootstrap_paragraphs_preprocess_paragraph', Array) (Line: 285)
Drupal\Core\Theme\ThemeManager->render('paragraph', Array) (Line: 436)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 474)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 53)
__TwigTemplate_0d2a5cff5d821a3844cacc2894d70c79->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 379)
Twig\Template->render(Array, Array) (Line: 40)
Twig\TemplateWrapper->render(Array) (Line: 53)
twig_render_template('modules/contrib/varbase_bootstrap_paragraphs/templates/field--entity-reference-revisions.html.twig', Array) (Line: 372)
Drupal\Core\Theme\ThemeManager->render('field', Array) (Line: 436)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 449)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 474)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 125)
__TwigTemplate_6df0c635901867843af8accb7aacc3e5->block_content(Array, Array) (Line: 171)
Twig\Template->displayBlock('content', Array, Array) (Line: 65)
__TwigTemplate_6df0c635901867843af8accb7aacc3e5->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array, Array) (Line: 43)
__TwigTemplate_e655cd44378c9121b4ac390f89667109->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 379)
Twig\Template->render(Array, Array) (Line: 40)
Twig\TemplateWrapper->render(Array) (Line: 53)
twig_render_template('themes/contrib/vartheme_bs5/templates/content/node.html.twig', Array) (Line: 372)
Drupal\Core\Theme\ThemeManager->render('node', Array) (Line: 436)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 239)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 171)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 54)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Proposed resolution
- Option #2: Switch Background Image to use Drimage and send the width of the screen
$url = Url::fromUri('internal:/')->toString();
if (substr($url, -1) === '/') {
$url = substr($url, 0, -1);
}
// Display Edge-to-Edge auto) fall back default background image using Drimage.
$file_path = $url . '/drimage/1600/0/' . $target_id . '/-' . $url . \Drupal::service('file_url_generator')->generateString($file->getFileUri());
A more dynamic way could follow by passing the width and tilt of the screen.
Remaining tasks
- ✅ File an issue about this project
- ✅ Addition/Change/Update/Fix to this project
- ✅ Testing to ensure no regression
- âž– Automated unit/functional testing coverage
- âž– Developer Documentation support on feature change/addition
- âž– User Guide Documentation support on feature change/addition
- ✅ Accessibility and Readability
- ✅ Code review from 1 Varbase core team member
- ✅ Full testing and approval
- ✅ Credit contributors
- ✅ Review with the product owner
- ✅ Update Release Notes and Update Helper on new feature change/addition
- ✅ Release
Varbase 10.0.0-beta1 →
,
varbase_bootstrap_paragraphs-10.0.0-alpha3 →
- ✅ No Update
- âž– Optional Update
- âž– Forced Update
- âž– Forced Update if Unchanged
User interface changes
API changes
Data model changes
Release notes snippet
- Issue
#3371685 →
: Fixed missing
de2e
(Display Edge-to-Edge auto) fall back default background image style after switching to Drimage