- Issue created by @amangrover90
- 🇺🇸United States mglaman WI, USA
We have some problems here:
- The code needs to move into the editor, how should we handle transliteration? Should we bubble the settings into the XB mount so it is accessible via configSlice?
- How would we access and use the transliteration library within React?
- I'm assuming this code needs to live within InputBehaviorsEntityForm for the path input, but can we know the value of the title from there? What is the best approach?
- We can't actually publish these entities due to the fact path fields are always invalid for new entities! See \Drupal\path\Plugin\Field\FieldWidget\PathWidget::validateFormElement().
foreach ($violations as $violation) { // Newly created entities do not have a system path yet, so we need to // disregard some violations. if (!$path_alias->getPath() && $violation->getPropertyPath() === 'path') { continue; } $form_state->setError($element['alias'], $violation->getMessage()); } }
I honestly don't know how to move forward here
- 🇮🇳India amangrover90
Blocked on https://www.drupal.org/project/experience_builder/issues/3504063 🐛 XB UI doesn't save the media/image or fields that involve Drupal javascript. Active
- 🇺🇸United States mglaman WI, USA
That's one reason we have this in the PageTrait for tests: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/path/...
protected static function assertSaveWithoutViolations(Page $page): void { // Path field is always invalid for new entities. // @see \Drupal\path\Plugin\Field\FieldWidget\PathWidget::validateFormElement().
From Core:
$element += [ '#element_validate' => [[static::class, 'validateFormElement']], ];
and in
validateFormElement
foreach ($violations as $violation) { // Newly created entities do not have a system path yet, so we need to // disregard some violations. if (!$path_alias->getPath() && $violation->getPropertyPath() === 'path') { continue; } $form_state->setError($element['alias'], $violation->getMessage()); } }
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Aha. It's the right level.
So the problem is that XB is not calling server-side widget logic. 📌 Support server side massage and validation of component prop form values Active is tackling a part of that, but it still won't call PHP
FieldWidget
server-side logic. See #3487284-6: [PP-3] Discover cases where is no 1:1 map between field, prop and widget values → , where that is being acknowledged.A more pragmatic short-term solution (and actually probably the better solution for Drupal core, too) is to:
- ignore at the
EntityConstraintViolationList
level this validation error - for any
\Drupal\path\Plugin\Field\FieldType\PathItem
field instance on the validated content entity - if the content entity is new (
::isNew() === TRUE
- ignore at the