By David Fiaty on
Hello everyone,
I am trying to programmatically copy a field from 1 content type to another one in D8. What works well with my code snippet: the content type fields are copied, the form display settings (manage form display) are copied.
What doesn't work: the display settings (manage display) are not. For example, a field with label "hidden" in the source content type will show label "above" after copy.
How are we supposed to programmatically get/set the display settings (label and format) of a field?
Thanks a lot for your answers.
Comments
Don't forget the "Widget"
I'm trying to do the same thing, either programmatically or scripted (during migration) via drush.
Other Settings are fine. I need to programmatically switch the form display widget to "Autocomplete (Tags Style"
thank you for any assistance or update.
I only needed to get the
I only needed to get the manage display settings and I did it like this: (I needed for each view mode)
Hope it helps.
Need to set the display of particular field to hidden by default
How to set the display of particular field to hidden by default progrmatically
thanks, useernamee. this is
thanks, useernamee. this is super helpful.
Also see this documentation
Also see this documentation for helpful snippets: https://www.drupal.org/docs/drupal-apis/update-api/updating-entities-and...
http://www.DROWL.de || Professionelle Drupal Lösungen aus Ostwestfalen-Lippe (OWL)
http://www.webks.de || webks: websolutions kept simple - Webbasierte Lösungen die einfach überzeugen!
http://www.drupal-theming.com || Individuelle Responsive Themes