Creating a page generates the URL path dynamically when editing.

Created on 15 January 2025, 3 months ago

Overview

  • When creating a page, the path is automatically generated
  • URL Path is generated based on the page name real time
  • Field is editable if user has permissions to edit the field.

Proposed resolution

User interface changes

Feature request
Status

Active

Version

0.0

Component

Page

Created by

🇮🇳India amangrover90

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @amangrover90
  • 🇺🇸United States mglaman WI, USA
  • Pipeline finished with Failed
    3 months ago
    Total: 883s
    #397475
  • Pipeline finished with Failed
    3 months ago
    Total: 809s
    #397690
  • Pipeline finished with Failed
    2 months ago
    Total: 926s
    #403687
  • Pipeline finished with Failed
    2 months ago
    Total: 4436s
    #403717
  • 🇺🇸United States mglaman WI, USA
  • Pipeline finished with Failed
    2 months ago
    Total: 976s
    #404629
  • Pipeline finished with Failed
    2 months ago
    Total: 1124s
    #404786
  • Pipeline finished with Failed
    2 months ago
    Total: 878s
    #407266
  • 🇺🇸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

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    #5: RE: the PathWidget violations: how does Drupal core deal with this in a standard entity form?

  • 🇺🇸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
Production build 0.71.5 2024