I recently needed to add functionality to the Password Policy module so I thought I would outline the steps I took in a blog post. The Password Policy module is used to enforce a stricter password policy on users on a Drupal site. This means that when a user creates or changes their password they must conform to certain rules like the password length, or if it contains upper and lower case characters. There are a set of rules to chose from and they can be fully customised by the site administrators.
One gotcha when importing configuration to a Drupal site can be a message that tells you that the configuration you are trying to import is from another site.
Here is the error that can be seen on the Configuration Synchronize page.
Installing a Drupal site from configuration is useful when running tests or if you don't have a copy of the database. You'll get a copy of the Drupal site without any content that will act in the same way as the live site. You can use modules like default content to add content into the mix so your newly installed site acts a little bit more like the live version.
Since there are some prerequisites to get this up and running I thought I would run through what is needed to get this working and how to run it.
A change that was snuck into Drupal version 8.8.0 and wasn't mentioned in the 8.8.0 change notes was a small change to the setting that controls the placement of the configuration directories. The alteration deprecated the $config_directories setting from the settings.php file and move the configuration into the $settings array. You can see the detail behind this change on the Drupal change record.
Whilst setting up docker on my local development machine the other day I encountered a permission problem. After installing docker I found that I had this permission problem that meant I couldn't run docker using my local user accounts. I was therefore forced to run docker as sudo, which I didn't want to do every time.
This is the error I was getting.
A common technique when creating graphics or visual representations of data is to map a value between two scales. This is useful when working on a set of values and you need to map them to a different set of values in order to show them on a graph.
The maths involved here is essentially figuring out the relationship between the value (v) in our initial scale (x, y) and multiplying this by the maximum range of the second scale (a, b).
The PHP splat operator (...) has been available in PHP since version 5.6. When it was introduced I made note of it but have never really used it, so I thought it might be interesting to explore it a little.
Internally, the ellipsis operator in PHP is called T_ELLIPSIS, although I have heard a few different names for the operator in the past. This includes names like:
A Data Access Object (DAO) is a way of taking data out of a database or API and present it in a unified way across your application. As a design pattern this has uses in standardising how a particular bit of data is passed around, without having to resort to using arrays to accomplish the same job.