Oktober 2018

Remove a base field from a custom content entity in Drupal 8

Drupal 8 comes with a new paradigm for the entity fields on content entities (there is also whole new thing of config entities, but this is not within the scope of this post). As with Drupal 7 there were properties and fields for an entity, now everything is a field (base fields, and field api fields via field UI). Similar to entity properties in D7, there are now base fields used in D8.

Endlos-Schleife bei Text-Element mit Ajax-Callback auf Event blur oder focusout

Wenn ein Drupal-Textfeld (input-Feld) einen Ajax-Callback verwendet und dieser auf die Events blur oder focusout reagiert, kann es zu einer Endlos-Schleife des Fokus-Verhaltens des Text-Felds kommen.

Der Ajax-Callback setzt den Fokus automatisch zurück auf das Feld welches das Ajax-Event (blur bzw. focusout) ausgelöst hat. Damit kommt es quasi zu einer Endlos-Schleife, in der der Fokus immer wieder auf dem Text-Feld landet und man nicht weiter im Formular navigieren kann.

Es gibt einen undokumentierten Parameter für den Ajax-Callback der dieses Verhalten aufheben kann: