Problem/Motivation

htmx 4 is committed and will be in Drupal 12: https://git.drupalcode.org/project/drupal/commit/2aa5aede43f

There may be some impacts for Display Builder.

Potential compatibility breaks:

Opportunities to simplify/consolidate our codebase:

Proposed resolution

How can we manage this?

The real challenge will be to be compatible with both htmx2 on Drupal 11.x and htmx4 on Drupal 12.x.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pdureau created an issue. See original summary.

pdureau’s picture

According to @fathershawn, we can use this to be be compatible with both:

  • Use \Drupal\Component\Utility\DeprecationHelper to call the different methods on Htmx in PHP.
  • Load the htmx compatibility extension to help with the event names.  I’m in the process of putting together a 3.x of the htmx contrib module with a bunch of extensions.

I guess compatibility here means: we keep using htmx2 API in Display Builder as long as we support Drupal 11.x, but those tricks make us compatible with Drupal 12.

Also, for "Attribute inheritance", i guess being explicit (which is mandatory in htmx4) is backward compatible with htmx2, because same mechanism and keywords.

Let's check all this.

rajab natshah’s picture

StatusFileSize
new120.01 KB
new253.42 KB

On Drupal 12.0.0-beta1 (PHP 8.5) with ^12 in the info files, Display Builder 1.0.0-beta8 installs and pages render, but builder pages return 500: HtmxEvents::onClickSavePreset() calls Htmx::prompt(), removed with htmx 4. With that call guarded, the canvas shows but the toolbar stays empty. display_builder_views also fails, because ViewDisplay::collectInstances() reads the now protected View::$display.

Screenshot

Screenshot

rajab natshah’s picture

Status: Active » Needs review