Skip to content

Expose experiment report URL in drupalSettings for DXPR Builder integration #22

@jjroelofs

Description

@jjroelofs

Summary

The ai_sorting module needs to expose the experiment report URL in drupalSettings so that DXPR Builder can link to the experiment reports page without hardcoding the URL structure.

Steps to reproduce

  1. Enable ai_sorting on a View
  2. Open the page with DXPR Builder
  3. Click the 3-dot menu on the View element
  4. Click "View AI Experiment" link
  5. Nothing happens - the link fails silently

What is the current bug behavior?

DXPR Builder expects drupalSettings.rl.views[viewKey] but ai_sorting exposes drupalSettings.aiSorting.views[viewKey]. Additionally, DXPR Builder expected an experimentBasePath that was never exposed.

What is the expected correct behavior?

The ai_sorting module should expose the full experiment report URL in drupalSettings so consuming modules don't need to know the URL structure.

Possible fixes

Add experimentUrl to the drupalSettings output in ai_sorting_views_pre_render() using Drupal's URL generation:

$experiment_url = Url::fromRoute('rl.reports.experiment_detail', [
  'experiment_id' => $experiment_id,
])->toString();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions