Using Media in Drupal is a much better option than using old-school image fields. You can add all types of fields to Media to enrich your images, videos, and other media types with additional information, and you can also reuse Media. All of that cannot be easily done if you are using regular image fields. Let's see how to programmatically create media.
Creating a file entity programmatically in Drupal sounds like a trivial task but there are some "gotchas" to be aware of. Let's dig in and explore tricky little things you need to know about.
A recent tweet by CHX got me thinking. Drupal 8 was released almost 5 years ago, and some things are still a mystery for a lot of developers, including me. Let's explore the various ways of updating field values in Drupal 8 and 9.
Menu Link Attributes is a great Drupal 8 and 9 module that allows you to add attributes to your menu links. Let's see how you can set the attributes programmatically.
Quick tip on how to set date fields programmatically in Drupal 8 and 9.
Creating a menu link programmatically in Drupal 8 and 9 is easy. You have to provide four values, link title and Uri, menu name for which you want to create a menu link, and optionally you can provide a link weight.