So, what exactly is white box testing? This article will discuss white box testing techniques, examples, and more.
Drupal technical Q&A
Agility is at the core of any Drupal site building project. The market changes fast, so the business needs. A Drupal site builder or developer also needs to support the business in this agile environment. This tutorial covers how to solve the error - "There is data for this field in the database. The field settings can no longer be changed."
In Drupal 8 or above managing configuration in code is not a challenge, but in the case of Drupal 7, it is still a big issue. Developers often create a module for this and use hook_update to maintain configuration in code. Here we are trying to list 10 common use cases for the making configuration changes using hook_update in Drupal 71 .
The SMTP module enables your Drupal CMS to use your existing SMTP based email delivery platform to send emails. This blog cover steps to configure the SMTP module for Drupal.
Testing email functionality in Drupal is a common use case every developer encounters frequently. Setup a full-featured email system locally or using a 3rd party service for just testing emails may not be feasible always. Mailhog is the best solution available for this scenario and the bonus point is that it works perfectly with Lando.
"The website encountered an unexpected error. Please try again later." this is the most common error encountered by a Drupal developer. Usually, errors are logged by Drupal and the logs can be accessed from Admin->Reports->Recent log messages. But when you get "The website encountered an unexpected error. Please try again later." you cannot even access the reports dashboard.
You can always create a view manually, and change the configuration one by one manually. And, all done. But, still, there is a chance of manual error. Drupal9 allows you to import-export views. You can follow the below steps to Import and Export views
In pre Drupal 8 era, the global variable $user was available every where, from you can easily get the current logged in user id. For all new version of Drupal, you should use \Drupal::currentUser()->id() Once you have the user id, you can use the User::load to get the user object.
The Drupal Publish Content module is a simple module that provides you additional permissions to allow users to publish or unpublish content without having to give the user the ability to administer all the content on your site. This module is a lightweight solution to help you build out your content management workflow on your Drupal site.
In Drupal we can use Drupal::entityQuery() & Node::loadMultiple() to load all nodes of given type
As we know, all content in Drupal is treated as a node. We can load a node entity by ID, but how can one load a node based on its title? Let's check how: It is interesting to see how Drupal improves overtime on this. In Drupal 6, it was just node_load.
We know Taxonomy is a powerful core module and helps us categorize the content. A vocabulary in Drupal is essentially a container for terms that are used by the system. These terms are what Drupal uses to connect certain areas together within the website.
Have you ever faced any difficulties while taking the backup of the Drupal site? Developers usually need to take the backup of the Drupal site during the time of the security update.
Have you ever faced problems trying to delete all the contents of a particular content type in a Drupal website? Drupal is a CMS technology and supports Drupal developers/content writers to add content. I think content writers can face problems while trying to delete content. There are two modules in Drupal that help us overcome this issue, they are:
Clearing cache is something that a Drupal developer do frequently. Here are the 4 most popular ways to clear the cache. 1.Install the devel module which adds a cache clear option for administrators. You'll find a devel block to add to a region for quick cache clearing. 2. If you install the admin menu and get a quick menu in the top left for clearing various caches in Drupal.
Drush is a free and open-source software command line and scripting interface for Drupal. It is very popular among Drupal developers. Here is a way to check whether your system has Drush installed and identify its version. Open a terminal, change to your Drupal project folder and execute the following command
If you installed the latest version of drupal9 it will have the following directories. compare to other versions of Drupal, drupal9 does not have a libraries folder
We can use the following command for downloading and enabling module till the version of drupal7 drush dl module_name drush en module_name -y In Drupal 8 and Drupal9 you no longer use Drush. Use composer command instead composer require drupal/module_name After, you will need to enable the module using the Drush command
Steps for Enabling or disabling maintenance mode using Drush 1. Run the following Drush commands to enable maintenance mode and clear drush state:set system.maintenance_mode 1 drush cr 2.Run the following Drush commands to disable maintenance mode and clear the cache:
We can install the latest version of drupal9 using the following command. composer create-project drupal/recommended-project my_site_name_dir This will create a project in 'my_site_name_dir' and automatically execute composer install to download the latest stable version of Drupal and all its dependencies. Your 'my_site_name_dir' will contain files that should be outside of your web root and not accessible by the web server. The web root will be 'my_site_name_dir/web'.