Hot answers tagged

2

You can pass down your region's ID as parameters to your route. For example: <a class="use-ajax" data-dialog-options="{&quot;width&quot;:550, &quot;dialogClass&quot;: &quot;my-region-class&quot; }" data-dialog-type="modal" href="/route/to/custom/form/this-region">...</a> As explained here you can add arguments from the ...


2

To use state for checkboxes element, you should target the specific element by JQuery selector, all elements they have the name="field_select_shipping" with value attribute different so try to target the input with both attributes try with the following to show adresse_home only if home and colissimo checkbox checked: $form['input']['adresse_home'] = [ ...


1

Taking a blind guess: Your context matches the entire parent container, so you can't filter by "new ones only" with context. But as a workaround you could specify a more explicit find to filter only new ones: This will add .i-was-here-first to every views row present on document ready: $(document).ready(function($) { $('.views-infinite-scroll-content-...


1

Drupal 8 doesn't cache Ajax forms anymore, so you can't get properties of the form object set in the initial form build. see Bypass form caching by default for forms using #ajax. Forms are only cached as rendered form. Put the entity id in a hidden form element to load the entity before saving. Add the entity cache tag to the form if you use default values ...


1

Based on @Jaypan answer and @FLY comment I made a FieldWidget. This indeed removed the need for the hook_managed_file_process and hook_element_info_alter. This also made it possible to use the widget on a per field basis. First make your custom FieldWidget in [MODULE]/src/Plugin/Field/FieldWidget: namespace Drupal\[MODULE]\Plugin\Field\FieldWidget; use ...


Only top voted, non community-wiki answers of a minimum length are eligible