Problem/Motivation

This snippet from ApiController:

  public function saveInstanceAsPreset(Request $request, string $builder_id, string $instance_id): HtmlResponse {
    $label = $this->t('New preset');
    foreach ($request->headers as $key => $value) {
      if ($key === 'hx-prompt' && !empty($value[0])) {
        $label = $value[0];
        break;
      }
    }
   ...

looks like a custom way of doing:

  public function saveInstanceAsPreset(Request $request, string $builder_id, string $instance_id): HtmlResponse {
    $label = $request->headers->get('hx-prompt',  $this->t('New preset'));
   ...

Proposed resolution

Try the solution with https://github.com/symfony/symfony/blob/7.3/src/Symfony/Component/HttpFo...

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

Issue summary: View changes
pdureau’s picture

Status: Active » Needs review

Waiting for pipeline execution

pdureau’s picture

Assigned: pdureau » mogtofu33

The leftover related to Presets is the consequence of:

Now we have a proper dependencies management, when we uninstall a theme which is a dependency of a PatternPreset, the PatternPreset config entity is deleted.

pdureau’s picture

mogtofu33 made their first commit to this issue’s fork.

  • mogtofu33 committed c68bede9 on 1.0.x authored by pdureau
    Issue #3540730 by pdureau: Use HeaderBag in ApiController::...
mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.