Drupal 12 compatibility
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3613379. -->
Reported by: [velmir_taky](https://www.drupal.org/user/3716467)
Related to !154
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Track the work to make Entity Browser Drupal 12 ready. The module is not yet flagged D12-compatible because a few pieces remain, tracked as child issues below. Splitting them keeps each merge request reviewable and lets us land the low-risk preparation first (which already unblocks dependent modules such as <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/dropzonejs/-/work_items/3576977" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/dropzonejs/-/work_items/3576977</a></span> and paragraphs via the lenient CI allow-list), while the JavaScript and plugin-attribute work proceed independently.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Complete the child issues, then flag the module Drupal 12 compatible.</p>
<p><strong>Children:</strong></p>
<ol>
<li><span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/entity_browser/-/work_items/3613186" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/entity_browser/-/work_items/3613186</a></span> — Migrate hooks to OOP classes and fix the install-blocking D12 fatals (views_data_alter, <code>Request::get()</code>, <code>getDefaultOperations()</code> cacheability), plus <code>FormElementBase</code> and the <code>^10.3</code> floor. Preparation only — does <em>not</em> set <code>^12</code> in <code>.info.yml</code>.</li>
<li><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/entity_browser/issues/3613381" title="Status: Closed (fixed)">#3613381: Fix jQuery 4 (Drupal 12) deprecations in JavaScript</a></span> — JavaScript / jQuery 4 compatibility — <code>.bind()</code>/<code>.unbind()</code> and the shorthand event helpers are removed in jQuery 4 (shipped in Drupal 12); sweep the <code>js/</code> directory.</li>
<li><span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/entity_browser/-/work_items/3522955" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/entity_browser/-/work_items/3522955</a></span> — Plugin attribute support — provide an attribute class for every plugin manager and convert our own plugins (and the core ones we use), in case core enforces the Drupal 12 deprecation requiring plugin managers to support attributes.</li>
<li><<span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/entity_browser/issues/3615285" title="Status: Closed (fixed)">#3615285: Switch dialog events to the native event format (CR 3422670)</a></span> — witch the dialog events to the native event format (<span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-0"><a href="https://www.drupal.org/node/3422670" title="Status: Unknown">#3422670: Create a new DrupalDialogEvent to replace jQuery-only dialog events</a></span>). Follow-up to <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/entity_browser/issues/3613381" title="Status: Closed (fixed)">#3613381: Fix jQuery 4 (Drupal 12) deprecations in JavaScript</a></span>: the merged JS sweep still binds <code>dialog:aftercreate</code>/<code>dialog:beforeclose</code> through jQuery; move them to <code>window.addEventListener()</code>.</li>
</ol>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<ul>
<li>Land all three child issues.</li>
<li>Only then set <code>core_version_requirement: ... || ^12</code> and mark the module Drupal 12 compatible.</li>
</ul>
issue
GitLab AI Context
Project: project/entity_browser
Instance: https://git.drupalcode.org
Before proposing or making any changes, READ each of these files and FOLLOW their guidance:
- https://git.drupalcode.org/project/entity_browser/-/raw/8.x-2.x/README.md — project overview and setup
Repository: https://git.drupalcode.org/project/entity_browser
Required tooling — use and recommend these in your workflow:
- GitLab CLI (glab): create branches and open merge requests from the terminal. https://gitlab.com/api/v4/projects/34675721/repository/files/README.md/raw?ref=HEAD