Problem/Motivation

From heyyo...

If you try to save SDDS components with images, there are errors with alt text:

OutOfRangeException: No data provided to evaluate expression ℹ︎␜entity:media:image␝field_media_image␞␟alt in Drupal\experience_builder\PropExpressions\StructuredData\Evaluator::doEvaluate() (line 44 of /var/www/html/web/modules/contrib/experience_builder/src/PropExpressions/StructuredData/Evaluator.php).
#0 /var/www/html/web/modules/contrib/experience_builder/src/PropExpressions/StructuredData/Evaluator.php(16): Drupal\experience_builder\PropExpressions\StructuredData\Evaluator::doEvaluate()
#1 /var/www/html/web/modules/contrib/experience_builder/src/PropExpressions/StructuredData/Evaluator.php(73): Drupal\experience_builder\PropExpressions\StructuredData\Evaluator::evaluate()
#2 /var/www/html/web/modules/contrib/experience_builder/src/PropExpressions/StructuredData/Evaluator.php(16): Drupal\experience_builder\PropExpressions\StructuredData\Evaluator::doEvaluate()
#3 /var/www/html/web/modules/contrib/experience_builder/src/PropExpressions/StructuredData/Evaluator.php(69): Drupal\experience_builder\PropExpressions\StructuredData\Evaluator::evaluate()
#4 [internal function]: Drupal\experience_builder\PropExpressions\StructuredData\Evaluator::Drupal\experience_builder\PropExpressions\StructuredData\{closure}()
#5 /var/www/html/web/modules/contrib/experience_builder/src/PropExpressions/StructuredData/Evaluator.php(68): array_map()
#6 /var/www/html/web/modules/contrib/experience_builder/src/PropExpressions/StructuredData/Evaluator.php(16): Drupal\experience_builder\PropExpressions\StructuredData\Evaluator::doEvaluate()
#7 /var/www/html/web/modules/contrib/experience_builder/src/PropSource/StaticPropSource.php(230): Drupal\experience_builder\PropExpressions\StructuredData\Evaluator::evaluate()
#8 /var/www/html/web/modules/contrib/experience_builder/src/Plugin/ExperienceBuilder/ComponentSource/GeneratedFieldExplicitInputUxComponentSourceBase.php(279): Drupal\experience_builder\PropSource\StaticPropSource->evaluate()
#9 [internal function]: Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\GeneratedFieldExplicitInputUxComponentSourceBase->Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\{closure}()
#10 /var/www/html/web/modules/contrib/experience_builder/src/Plugin/ExperienceBuilder/ComponentSource/GeneratedFieldExplicitInputUxComponentSourceBase.php(276): array_map()
#11 /var/www/html/web/modules/contrib/experience_builder/src/Controller/ClientServerConversionTrait.php(129): Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\GeneratedFieldExplicitInputUxComponentSourceBase->validateComponentInput()
#12 /var/www/html/web/modules/contrib/experience_builder/src/Controller/ClientServerConversionTrait.php(172): Drupal\experience_builder\ClientDataToEntityConverter::clientModelToInput()
#13 /var/www/html/web/modules/contrib/experience_builder/src/ClientDataToEntityConverter.php(49): Drupal\experience_builder\ClientDataToEntityConverter::convertClientToServer()
#14 /var/www/html/web/modules/contrib/experience_builder/src/Controller/ApiAutoSaveController.php(193): Drupal\experience_builder\ClientDataToEntityConverter->convert()
#15 [internal function]: Drupal\experience_builder\Controller\ApiAutoSaveController->post()
#16 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#17 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(593): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#19 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#20 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(183): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#21 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#22 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#23 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#24 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#25 /var/www/html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#26 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#27 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
#28 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#29 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#30 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#31 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#32 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(709): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#33 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#34 {main}

Steps to reproduce

  • Configure Drupal+XB+SDDS
  • Drag a component with an image on it
  • Try to save the page

Proposed resolution

TBD

Remaining tasks

  • Debug and figure out if it needs to be fixed in SDDS or XB
  • If the former, fix it
  • If the latter, can we workaround it until it's fixed in XB?

User interface changes

Can save page with component with image

API changes

Data model changes

Comments

kristen pol created an issue. See original summary.

kristen pol credited heyyo.

kristen pol’s picture

Adding credit

kristen pol’s picture

Priority: Major » Critical

Actually bumping to critical since saving is probably part of the demos

kristen pol’s picture

I have just confirmed the error and will be debugging.

kristen pol’s picture

I've confirmed that it happens with the image component that is defined in XB as well so it's not an SDDS thing.

I'll see if I can find a fix or workaround in the XB code.

kristen pol’s picture

If you use a new image from the media library, it works so it seems to be just for the examples data

kristen pol’s picture

Known issue here:

#3509608: Unable to save an optional image with its default value (because it does not correspond to a Media entity): allow saving DefaultRelativeUrlPropSource

I'm wondering if we'd be able to hack it for now but uploading a media field and then specifying that uuid in the examples, so that it actually pulls from a known thing

I'll play with that

kristen pol’s picture

Can't hack it...

I've confirmed that the only values that you can use for image examples are src, alt, width, and height (per the json schema)

kristen pol’s picture

It would be interesting to be able to use examples with an existing media image that you added during the install of the theme by adding the config to config/install.

Or probably better, XB could auto-generate media entities from examples if the image doesn't exist in media yet and use that so that the user can still use the examples data rather than adding their own images.

kristen pol’s picture

We can work around using multiple default content recipes so that media is added first and then nodes.

kristen pol’s picture

Assigned: kristen pol » Unassigned
Status: Active » Fixed

This has been done in xb-demo by programmatically adding the home page.

The XB team is still working on updating XB to handle this stuff.

kristen pol’s picture

Status: Fixed » Closed (fixed)