You can get current users order/cart with this
You can get current users order/cart with this
The key here is to pass variables over 'drupalSettings' => ['myData' => $some_value], where you can then pass whatever you need to decoupled app(react)
To get full country name you need to use CountryManager class and you can then get all the info you need. So lets say you have some country code store in $shipping_code variable, to get full country name
If you want to add some JS code, like some kind of snippet to your pages with libraries.yml, add it as any other library item but don't use jquery or drupal behaviours in .js code, add some plain JS code like
document.addEventListener("DOMContentLoaded", function() {
so to wrap some JS snippet for it, do it like below.
One thing to take note when using ajax callbacks on filed that can have unlimited number is to use delta in wrapper names.
To set which other entity type should your field reference you can do it with this settings on base field
When creating custom entity you will use "BaseFieldDefinition" code snippets where you will define many things about this field, one of the things you may want to define is suffix or prefix that will be used in display of this field either on entity view or on views that use this field. To do that you will add it to setSettings array simple as 'suffix' => '%'
When building forms it is useful to have widgets that select multiple values for you and enhance UI, if you have large select list I would recommend to use select2 module to make custom form use its widget you should first get an array of elements in a variable, like
As Batch is dependent on the order of query string parameters if you are using Fastly or some other CDN they often have "Query String Sort" enabled or it is a good practice to do that, as it will result in more cache hits for you.
Want to make a quick patch for changes you made in some contrib module to submit it to d.org ?
Write down this and submit the file
git diff > my_changes.patch
if you want diff from staged files use
git diff --cached > my_changes.patch
To change paths of the patch use