This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Using TWIG template for a page loaded into a modal

I have a page (form) that I've created a twig template for, it's called `form--edit-communication-method-form.html.twig`, it loads in my actual form items as well as some other markup to polish everything up. However, now I need to present this form in a modal, and I'm attempting to do so by loading the form like so

How to get a custom ...?id=... from my URL?

I want to have an ID in my URL and the controller of my module should take the ID from the URL and display it. If the ID is changed in the browser and the side is reloaded, the page should print out the new ID. My problem is, that I can't get the ID out of the URL.

Example: /node/31?id=930bcae8-f8e5-491f-84fc-cdf104ca7e40

I have tried to following lines of code, to get the id and print it out:

'text' => \Drupal::request()->query->all(), <- prints out nothing

Disable default behaviors of the Dialog Modal

I am attempting to use a modal on a particular page using the following link to get there

<a class="use-ajax" data-dialog-type="modal" href="/my-modal-page">

However, there is some default modal behaviors I would like to disable:

Custom fields, repeatable without using paragraphs?

Hi everyone, I was hoping you might have some ideas as we have been unable to find workable solutions.

In our new site migration project, we are attempting to build a content type that includes a compound field group (custom field) that is also repeatable. We are avoiding Paragraphs due to the performance issue related to nested paragraphs and translations.

Filter out View results programatically

I have to filter out some view results programmatically because the filter is more complicated than what the build-in filter can handle. Now in the template file I've created for this view, it must display 3 items regardless of if 3 view result rows exist, if a view result row doesn't exist it displays a placeholder. 

I've been able to filter out the rows by creating a temp array and setting $view->result to that, however, after resetting the array keys to be a normal order (0, 1, 2, ...) the template file is unable to access those... 

Here's what my custom filter does

Modify Relationship Fields in hook_views_post_execute

My account object has a EntityReference field list (for custom content-type Degrees) and I created a view to display this list of the degrees. The view is a User view with a relationship to the EntityReference field.

As I have it now, the view pulls in the X number of Degrees the current user is associated with, however, I need to modify the results to append some text to the matchedCareer field that exists on the Degree content type.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions