Drupal 9 is designed to be updated with Composer where previous versions allowed manual uploading of files or by using Drush. This is an easy process and can be done running the following at the command line in the 'root' level where your sites composer.lock file is located.
composer outdated "drupal/*"
This will return any Drupal core or modules that are out of date and the suggested version. An example is as follows:
Image styles within Drupal are one of the things you take for granted, yet are one of Drupal's best tools. A user with CMS access can create an 'Image Style' which can be used on a content type display page or within a 'View', all without any coding.
However, sometime you have to add an image style within a template (Drupal 7) or a module. So how d o we do this?
Normally we will start with something called a 'URI'. Take a look at these two Drupal 7 examples:
There are a few basic things a developer needs to do in a custom module.... SELECT, INSERT and DELETE queries are top of my list and this article demonstrates a few examples of SELECT and INSERT queries.
This code is within a controller that is part of a custom module. I won't explain how to build the module but this code is within a file called ReportController.php.
The basic file code is:
Whilst converting a D7 site to D9 I came across some SQL in the node.tpl.php template. This clearly shouldn't be in the template and the poor developer had added a comment saying as much, but was clearly under pressure and maybe not as experienced as they needed to be.
So, with D9 using TWIG I needed to move the SQL to another place.... and the THEME_preprocess_page() function is probably the best place.
Sometimes you need to get a field in the page.html.twig template. The template hierarchy suggests that node values (fields) should be rendered in the node.html.twig template and page.html.twig is the parent template that should be dealing with regions etc.
The solution is use THEME_preprocess_page() to reference the node and get the field. There are 3 ways to do this (probably more) but the examples below show the array and simple string methods. The field is 'Video Id' which has a machine name of 'field_video_id'.