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

How can i preprocess variables php to js

Hello im making a module and im trying to pass a php variable to js.

I have a php class and i try to make something like this:

$hello['welcome_message']['#attached']['library'][] = 'commerce_payment_cetelem/js_cetelem';
$hello['welcome_message']['#attached']['drupalSettings']['data']= "hello";

In the javascript i did:

(function () {
  'use strict';
var data = drupalSettings.data;
console.log(data);
})();

In the info.yml i add the dependencies

ID in table

Hi, in a module I have to manage a table that I fill with the result of a query
The $ nodes array contains the query result

$nodi = $this->q( $storage, $dData ) ;

With foreach ($nodi as $row) {
I loop the array and fill the table.

$form['table_dispo'][$row->nid->value]

A table field is an autocomplete entity reference that invokes a callback

Module to over-write/re-install same module.

Greetings,

About 2 months back had to uninstall xmlsitemap and it is a large site with Cloudflare support (mostly) which timed out the uninstall process. The result was a half remove xmlsitemap module and have raised the issue there.

Infinite loop on get form redirection

Hi,

I have a problem that I do not know how to solve it.

I have made a form which is a 'get' form. I have put the good function to take care of the submit function ($form_state->setAlwaysProcess(TRUE);). I have made a redirection in the submitForm method but when I load the page where the form is, there is an infinite loop. I also test in the submitForm method when the get parameter 'op' (which is the name of the submit button) is empty to prevent an infinite loop.

I want to know how to make a redirection with a 'get' form.

Here is my code :

autocomplete deluxe for entity reference

i have a filed of type entity reference i want to use autocomplete deluxe for this widget type but i m getting 

checkboxes/radio

select list

autocomplte tag style

auto complete

how can i use autocomplte deluxe for entity reference type fileds..is there any alternative module is there to achive this

Closing modal form after submit

From a view, through a button, I open a custom form, in a modal form. This module also has a submit to save the changes made.
After using the submit the form must close automatically and remain on the view.
I currently stay on the form

Pages

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