New York
Account created on 23 October 2009, almost 16 years ago
#

Merge Requests

More

Recent comments

🇺🇸United States fathershawn New York

I don't see a method nor a property for Request on ControllerBase. Am I missing something? Does this push us towards an argument resolver?

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

Test passes. CR created.

🇺🇸United States fathershawn New York

Thanks @larowan. That's +2 for a trait, plus where to start with it in core! I think the trait is easier for contrib developers to understand who might be doing something of controller/form context. Controller/form will be a 90% use case I bet.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

This looks good to go to me.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

@nod_ My concern is about a conflict with the state stored in the form and the state stored in the request URL. Consider a form with an input A that responds to user interaction and sends the values in a get request.

Focusing only on values for clarity

  1. User sets A to 1
  2. The input regenerates, containing data-hx-get="/path?A=1

Now if I set the value to 2 I am explicitly declaring that I will send 1. Isn't that confusing? It seems like the state encoded in the form should be the source of truth.

🇺🇸United States fathershawn New York

I have a concern with current url and query parameters.

If the form is using get, won’t the url for a new request contain the prior request parameters?

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

Problem/Motivation

Document how to implement ReplaceCommand using htmx

Proposed resolution

Document at https://www.drupal.org/docs/develop/drupal-apis/htmx/ajax-api-to-htmx/replacecommand →

Remaining tasks

Edit linked page and add documentation

User interface changes

None

Introduced terminology

None

API changes

None

Data model changes

None

Release notes snippet

None

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

Refactored the test to use a data provider.

🇺🇸United States fathershawn New York

fathershawn → changed the visibility of the branch 3546105-static-method to hidden.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

add issue number

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

We are adding these pages under https://www.drupal.org/docs/develop/drupal-apis/htmx/ajax-api-to-htmx → . I'm creating the child issues and standing up stub pages.

🇺🇸United States fathershawn New York

Completed

🇺🇸United States fathershawn New York

Added  cross reference for how to return CSS.

🇺🇸United States fathershawn New York

Gitlab CI doesn't like MRs between issue branches:

  Invalid version string "3546105-improve-url-management-dev"  

but the kernel test passes locally.

🇺🇸United States fathershawn New York

Opened an MR with a working kernel test to your issue branch @nod_

🇺🇸United States fathershawn New York

Feedback addressed and all tests passing.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

Made a couple of suggestions. I'll check back later to see if the unit test is running.

🇺🇸United States fathershawn New York

Yes - forms are also covered by this CR. We definitely plan to document each Ajax Command paired with an equivalent implementation using HTMX. There will be a documentation issue for each and a corresponding page.

For the CR you would would like an additional before? Something like:

Before (Ajax API)

    $default_type = $form_state->getValue('config_type', $config_type);
    $form['config_name'] = [
      '#title' => $this->t('Configuration name'),
      '#type' => 'select',
      '#options' => $this->findConfiguration($default_type),
      '#default_value' => $config_name,
      '#prefix' => '<div id="edit-config-type-wrapper">',
      '#suffix' => '</div>',
      '#ajax' => [
        'callback' => '::updateExport',
        'wrapper' => 'edit-export-wrapper',
      ],
    ];

Would that be helpful?

🇺🇸United States fathershawn New York

I put up MR!13205. I discussed this idea with @nod_ in Slack. The static method makes creating or modifying the Url object relatively simple and the changes are fewer and easier to test.

Here's an example code block:

$url = Htmx::mainContentOnly(
   Url::fromRoute('test_htmx.attachments.replace', [], $options)
);

$htmx = new Htmx();
$htmx->get($url);
🇺🇸United States fathershawn New York

All tests passing - only changes to the form. Existing test could remain in place because of HTMX detection added in 📌 Support dynamic forms using HTMX Active

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

Of course @kevinquillen. What questions did it leave you with or examples would you like?

We also have planned a whole set of documentation pages pairing Ajax API commands with how to accomplish that with these new tools.

🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York
🇺🇸United States fathershawn New York

fathershawn → changed the visibility of the branch 11.x to hidden.

🇺🇸United States fathershawn New York

fathershawn → made their first commit to this issue’s fork.

🇺🇸United States fathershawn New York

Yes - and there is another performance bottleneck when adding an AttributeValue class - cloning that object is expensive.

🇺🇸United States fathershawn New York

fathershawn → created an issue.

🇺🇸United States fathershawn New York

@ipumpkin That sounds like a bug. Please create a new issue related to this one. Please also give steps to reproduce the bug.

🇺🇸United States fathershawn New York

Thank you @webengr for your thoughtful comments. I did build and contribute this for the use case of the /donate flow, generalized from something a client needed. I do have ideas for a more general version usable by site builders that I intend to get to out of my head and into code.

🇺🇸United States fathershawn New York

+1 still RTBC

🇺🇸United States fathershawn New York

Tests adjusted and expanded based on feedback. All tests passing and ready for re-review.

🇺🇸United States fathershawn New York

Reviewed and confirmed. back to RTBC!

🇺🇸United States fathershawn New York

Updated the test based on review.

🇺🇸United States fathershawn New York

Updated based on latest review

🇺🇸United States fathershawn New York

fathershawn → changed the visibility of the branch 3522597-wrapper-format to hidden.

🇺🇸United States fathershawn New York

Moved how to handle routes/controllers built to service htmx requests to 📌 Return only main content for endpoints designed to service htmx requests Needs work . Reviewed with @nod_ this morning and this issue is now RTBC

Production build 0.71.5 2024