WI, USA
Account created on 12 December 2012, about 12 years ago
#

Merge Requests

More

Recent comments

🇺🇸United States mglaman WI, USA

Opening an MR. I kept the cmdk code so it can be tried out in Storybook.

Here's some screenshots from implementation w/o cmdk

🇺🇸United States mglaman WI, USA

cmdk also doesn't support object values when selected, only strings. And it messes with them per https://github.com/shadcn-ui/ui/issues/889

I know it's been widely adopted, but as I keep researching I keep finding wild workarounds for it for folks using it because of shadcn/ui.

🇺🇸United States mglaman WI, USA

I quick asked @bostonjillian on how we should handle long page titles and slugs:

We could make this a bit wider, and let's do a character count cap with ellipses for like sentence level titles. Anything more than like 5 words is too long. Hover state, do a tool tip with the full title when hovering over the title.

🇺🇸United States mglaman WI, USA

After rechecking the designs, the navigation shows the page title and its path. Can we have the API also include the path for the page.

🇺🇸United States mglaman WI, USA

I'm working on using cmdk. I'm not 100% sure if it's the best approach since its filtering is based on available items. I'm not sure how well it works searching against a large dataset. https://github.com/shadcn-ui/ui/issues/868 has a related example/problem for combobox that is powered by cmdk. The main benefit is that cmdk has all the accessibility and keyboard interactions.

But the design shows a kebab menu for additional actions, which isn't a normal part of cmdk. I'll push forward a bit more. I don't think we'll lose a lot if it's not the way to go.

🇺🇸United States mglaman WI, USA

required title cannot yet be specified by the author.

The title is populated as "Untitled page"

It is also specified that it should be unpublished.

This was approved by laurii and I believe effulgentsia

Edit:

The UX is: Click "New", brought to editor for a page named "Untitled page"

🇺🇸United States mglaman WI, USA

Started messing with this and I want to sync w/ balintbrews about using the cmdk library versus Radix primitives directly.

🇺🇸United States mglaman WI, USA

Going to take a stab at the failure POST 403 /web/xb-field-form/node/1?.

🇺🇸United States mglaman WI, USA

After looking at the update route

experience_builder.api.content.update:
  path: '/xb/api/content-update/{entity_type}/{entity}'

I suppose it should be

experience_builder.api.content.create:
  path: '/xb/api/content-update/{entity_type}

But we have logic in the controller which fails if the entity type is anything else but xb_page (for now.)

🇺🇸United States mglaman WI, USA

After reading 🐛 Controllers performing data modification should make use of CSRF tokens via /session/token Active , I think the approach should be changed. Originally the idea was just a regular link which would redirect to the editor. Instead it should be a POST request and then redirect based off of the response data.

Request:

POST /api/create/xb_page

Response

201 Created

{
  "data": {
     "xb_page": {
         "id": 123
     }
  }
}

Then the editor can redirect to /xb/xb_page/123.

This unblocks the need for CSRF since we're using a POST method

🇺🇸United States mglaman WI, USA

This can be worked via storybook. Assigning to myself to track down design screenshots and previous notes.

🇺🇸United States mglaman WI, USA

amangrover90 on my team is picking this up, assigning to myself since I can't assign to him

🇺🇸United States mglaman WI, USA

I don't know if we should really be using this ticket as there isn't pre-planning happening on D.o, but I can keep associating tickets to this. If you would like to, we should chat on the best way to accomplish it.

🇺🇸United States mglaman WI, USA

phpstan-drupal uses a stub provider, so we can fix here and back port anything to phpstan-drupal and use a version check on Drupal to decide if the phpstan-drupal stub should be loaded or not

🇺🇸United States mglaman WI, USA

Next steps for this meta will involve around the in-XB navigation. Working on a doc and issue map. I'll update here once there are more next steps.

🇺🇸United States mglaman WI, USA

Personally I think we should leave the restriction in for now and open a follow-up to add test coverage.

Agreed. The main goal was to ensure we have two testable paths, as there is some upcoming work which will be made a lot easier by targeting pages only.

🇺🇸United States mglaman WI, USA

Ugh, I looked too fast:

    self::assertArrayHasKey('xb_test_page', $this->drupalSettings);

This is from the test module hook xb_test_page_xb_page_view:

function xb_test_page_xb_page_view(array &$build): void {
  $build['#attached']['drupalSettings']['xb_test_page'] = [
    'foo' => 'Bar',
  ];

It's to verify \Drupal\experience_builder\Entity\PageViewBuilder::alterBuild. The hook needs to specify the library I guess.

🇺🇸United States mglaman WI, USA

Merged, I feel the power! 💪

🇺🇸United States mglaman WI, USA

Perfect, thanks for optimizing

🇺🇸United States mglaman WI, USA

I'm slightly confused since the XB controller specifies drupalSettings in its render array. I don't get why removing the library definitions would break the test...

Unless in Kernel test the automatic addition of the library doesn't happen like in a fully bootstrapped system? I'll dig in.

🇺🇸United States mglaman WI, USA

The code was:

    $page = $this->entityTypeManager->getStorage('xb_page')->create([
      'title' => $title,
      'uuid' => $uuid,
      'path' => [['alias' => $path]],
      'status' => TRUE,
    ]);
    $page->save();

Which is what a lot of developers may do, since most do not call `validate` before saving. I have a feeling people will programmatically create the entities and while technically invalid expect them to work without XB crashing.

🇺🇸United States mglaman WI, USA

I'll keep assigned to me. amangrover90 from my team is picking this up and I pinged him to make sure he reviews. I like the approach, good idea @wim leers!

🇺🇸United States mglaman WI, USA

@dpacassi sorry for the delay, but testing the patch now with rc14. Just rebased the MR

🇺🇸United States mglaman WI, USA

Copying in the full error so people find this issue more easily.

🇺🇸United States mglaman WI, USA

So its override may lead us to lost some features.

That is fair. Right now the Gin theme is completely broken if the module is turned on. What if we leveraged ignore missing to allow progressive enhancement once the toolbar-button.html.twig is added back?

From the docs: https://twig.symfony.com/doc/3.x/tags/include.html

You can mark an include with ignore missing in which case Twig will ignore the statement if the template to be included does not exist. It has to be placed just after the template name. Here some valid examples:

{% include 'sidebar.html' ignore missing only %}
🇺🇸United States mglaman WI, USA

I just started, not on the main team though. I'll check that issue tomorrow and raise it internally.

🇺🇸United States mglaman WI, USA

🫠 apparently I search all the wrong ways. Sorry, I wanted to avoid making a duplicate.

I'm working on XB and using Gin. We're going to need the top bar, so we'll patch around it.

🇺🇸United States mglaman WI, USA

Not sure how heavy to go into the tests.

🇺🇸United States mglaman WI, USA

I know one thing. Find all items like assert($entity->hasField('field_xb_demo')); to support pages and their components field.

🇺🇸United States mglaman WI, USA

Assigning to @laurii to help flush this out. The remaining item is 📌 Page should have author/user reference Postponed: needs info but I'm not entirely sure what is next. Maybe pivoting from `node/article` to `xb_page` and pushing forward other features in XB. I'm not sure.

🇺🇸United States mglaman WI, USA

Replied about the enhancer. And the test passed once I added video recording to debug... so let's see if it passes again when I remove videos.

🇺🇸United States mglaman WI, USA

I have to completely rewrite ApiPreviewControllerTest due to its usage of XBTestSetup. Unless we skip defining dependencies in the test base class, which is completely useless. Perhaps it should have all gone into a trait as I was wondering in my MR.

🇺🇸United States mglaman WI, USA

Because you cannot add dependencies to be installed on the base test. The test this issue added runs the site setup install script, which manually installs modules. It assumes a non-kernel test environment.

🇺🇸United States mglaman WI, USA

Per #3452712-16: Possibly script loading/placement issue and the reference core issue, this should fix some problems. We need the main library in the header. But AJAX should be okay without that toggle.

🇺🇸United States mglaman WI, USA

There's a reason we needed it to be in the header. Unfortunately I can't recall why. I'll look.

🇺🇸United States mglaman WI, USA

This copied \Drupal\Tests\experience_builder\Kernel\ExperienceBuilderTestBase and broke any test using it when dependencies are installed due to how \Drupal\Tests\experience_builder\TestSite\XBTestSetup operates.

🇺🇸United States mglaman WI, USA

#20 still requires the field module to be installed, even though generic field support has been added:

  // Call proxy implementations.
  if (\Drupal::moduleHandler()->moduleExists('field')) {
    _field_token_info_alter($info);
  }

The module exists check can be removed.

🇺🇸United States mglaman WI, USA

And then I saw

      $provider = '';
      if (isset($info['types'][$token_type]['module'])) {
        $provider = $info['types'][$token_type]['module'];
      }
      if (!($field instanceof FieldStorageConfigInterface) && $provider != 'token') {
        continue;
      }

Adding as feedback to that issue.

🇺🇸United States mglaman WI, USA

mglaman changed the visibility of the branch 3479454-php-8.3-deprecations to active.

🇺🇸United States mglaman WI, USA

I don't know how #6 and #7 can work, as Drupal doesn't support array callables in lazy builders. The fix is to use `get_class($this)`. or `static::class . '::` still

🇺🇸United States mglaman WI, USA

Applied suggestions, thanks @wim leers. I want to clarify how in depth we should provide a suggested solution for point 3 on.

🇺🇸United States mglaman WI, USA

The MR has been updated to use the approach found in the json_field module, where SQLite uses the "text" type, avoiding the core patch.

🇺🇸United States mglaman WI, USA

Okay, so what's left? Add this line to each driver? I don't know what value the in-code comment would provide. Or would the comment be for why we only added it to SQLite and not the others?

      // @note: Only the SQLite driver has this field map to due to a fatal error caused by this driver's schema
      // @todo: Add to all drivers in XYZ
      'json:normal'     => 'JSON',

Something like this?

🇺🇸United States mglaman WI, USA

re #15

1. tests can be run with mysql locally, and it's one test that fails on sqlite without the patch
3. blame Drupal core for not providing enough ways to govern things via code and magically through config objects 😬, I'll try to find a way though.

🇺🇸United States mglaman WI, USA

@wim leers metatag uses text for all? https://git.drupalcode.org/project/metatag/-/blob/2.0.x/src/Plugin/Field.... I think I know what you're talking about, though. Is it the json_field? https://git.drupalcode.org/project/json_field/-/blob/8.x-1.x/src/Plugin/...

Note they use text for the sqlite_type! XB does not.

     'columns' => [
        'value' => [
          'type' => 'json',
          'pgsql_type' => 'json',
          'mysql_type' => 'json',
          'sqlite_type' => 'text',
          'not null' => FALSE,
        ],
      ],
    ];

re #9 I highly doubt Add "json" as core data type to Schema and Database API Needs work is going to make enough progress anytime soon.

we should at least at testing for the change and a comment about why the change is done.

I'll see if I can make a quick enough test. Hopefully without a field type and just manipulating a table with a JSON column.

🇺🇸United States mglaman WI, USA

Should be set, now.

🇺🇸United States mglaman WI, USA

Found a flaw. The route experience_builder.experience_builder requires a saved entity. There isn't a "new entity" route yet. I don't know if this issue should be modifying \Drupal\experience_builder\Controller\ExperienceBuilderController::__invoke to allow $entity to be nullable.

'base' => \sprintf('xb/%s/%s', $entity->getEntityTypeId(), $entity->id()),

This would break if null. But the entity type is a route parameter, so it could be added as a method argument.

Then in the method, if the entity is null we could pass an ID of `0`?

🇺🇸United States mglaman WI, USA

The initial review was addressed

🇺🇸United States mglaman WI, USA

This is not done in that issue. This issue is to implement entity owner interface.

🇺🇸United States mglaman WI, USA

It also makes the standard way of doing "Who created the page" a lot easier (target default data table vs revisions)

🇺🇸United States mglaman WI, USA

The MR working on adding the entity type already extends Drupal\Core\Entity\EditorialContentEntityBase, so it'll be covered. But not the idea of "owning" a page like node and media already do

🇺🇸United States mglaman WI, USA

Technically the revision log gives us all of that information, revision log entries always reference a user.

This issue would enable "edit|delete own" and "edit|delete any" permissions.

🇺🇸United States mglaman WI, USA

mglaman changed the visibility of the branch 3487533-cannot-delete-a to hidden.

🇺🇸United States mglaman WI, USA

ugh picked the wrong branch

Production build 0.71.5 2024