Guzzle is a great HTTP Client, but it can be difficult to figure out how to get access to its error messages. I've put together a blog post explaining how to catch GuzzleException, and retrieve the full response from the remote server, making debugging Guzzle errors much easier:
I had some serious form caching with a custom form that sets a few of my module's config settings. Normally the config form would be reserved for an admin/settings page, but with this project I don't want the users to access Drupal's back-end. Instead, I've rebuilt most of the necessary back-end config forms on the front-end, so they can still make certain config changes.
^^ This lead to some serious caching issues;
Most caching solutions I found centered around using render arrays with markup elements, but nothing for form element render elements.
I needed to retreive the system.site page.front config value from js on front end (progressive decoupling)
I first thought of using hook_page_attachments_alter() and inject the value in drupalSettings
But then i built a little module which provide any "simple config" through REST resource
I'll paste the rest resource plugin bellow but i have some questions :
{#
/**
* @file
* Default theme implementation for message entities.
*
* Available variables:
* - $content: An array of comment items. Use render($content) to print them all, or
* print a subset such as render($content['field_example']). Use
* hide($content['field_example']) to temporarily suppress the printing of a
* given element.
* - $title: The (sanitized) entity label.
* - $url: Direct url of the current entity if specified.
* - $page: Flag for the full page state.
I'm currently using some jQuery on my Drupal 8 website, but my function is running on every request and the lists generated by the script are duplicated. I tried to use .once() to avoid this problem, without success.