What's a zombie process in Linux?
abhai 23 October 2023In Linux, a zombie process is a state that a child process enters when it has finished executing, but its exit status has not yet been collected by its parent process. Zombie processes are essentially dead processes that are waiting for their parent process to retrieve their exit status.
Tags
What is patch level in git and composer?
abhai 20 October 2023You might have seen the command "patch -p2" or an entry in composer.json when using cweagans/composer-patches like the following.
"patchLevel": { "drupal/core": "-p2" }
In the command "patch -p2," the "-p2" flag specifies the patch level.
The "patch" command is used to apply changes, or patches, to source code files. The "-p" flag followed by a number tells the patch command how many directory levels to strip from the file paths mentioned in the patch file.
How to correctly set Content-Security-Policy headers?
abhai 19 June 2023Setting the Content-Security-Policy (CSP) header correctly is an essential step in enhancing the security of your web application. The CSP header allows you to define a policy that restricts the types of content that can be loaded by a web page, thereby mitigating risks such as cross-site scripting (XSS) and data injection attacks. Here's a general guide on how to correctly set CSP headers:
Tags
What does the final keyword do in PHP?
abhai 3 June 2023In PHP, the `final` keyword is used to restrict the inheritance and overriding of methods and classes. Here's what it does in different contexts:
Tags
What are the types of inheritance in PHP?
abhai 3 June 2023In PHP, there are three types of inheritance:
Tags
How to use the t() function in Drupal 9?
abhai 9 May 2023The t() function is used for translating user-visible text in Drupal 9. It takes a string as input and returns a translated string. Variations of the t() function exist in JavaScript and Twig as well.Why did Drupal decide to move towards Object oriented programming paradigm?
abhai 1 May 2023Drupal made a significant shift towards adopting the object-oriented programming (OOP) paradigm starting with its major release, Drupal 8 many many moons ago. I'm sure many wanted to know why. Drupal addressed the criticism of the lack of explicit use of object-oriented programming (OOP) in Drupal's source code and API by explaining the reasons behind their design choices. Here are the key points they mentioned:
How to override a controller class in Drupal?
abhai 13 April 2023In Drupal, you can override a controller class by implementing a custom route subscriber. Here are the steps to do so:
-
Create a custom module: Create a custom Drupal module if you haven't already. You can do this by creating a new folder with the module name in the
modules/custom
directory of your Drupal installation, and adding a*.info.yml
file to define the module.
Tags
-
How to override a service class in Drupal using a service provider class?
abhai 13 April 2023In Drupal, you can override a service class using a service provider class. Here are the steps to do so:
-
Create a custom module: Create a custom Drupal module if you haven't already. You can do this by creating a new folder with the module name in the
modules/custom
directory of your Drupal installation, and adding a*.info.yml
file to define the module.
Tags
-
How to override a service class in Drupal?
abhai 13 April 2023In Drupal, you can override a service class by creating a custom module and using the service decoration pattern. Here are the steps to do so.Tags
How to create nested vertical tabs in Drupal 9 config form?
abhai 12 April 2023Here's how you can create nested vertical or horizontal tabs in Drupal Form API:
-
Define your configuration form using the Drupal Form API by creating a new form class that extends
ConfigFormBase
orFormBase
. -
Add a
vertical_tabs
element to your form using theDrupal\Core\Render\Element\VerticalTabs
class. This will create the top-level vertical tabs. -
Inside each top-level vertical tab, add another
vertical_tabs
element to create the nested vertical tabs.
-
How to increase php memory limits only for Drush commands in Drupal settings file
abhai 12 April 2023To increase the PHP memory limit for all PHP CLI (Command Line Interface) commands in Drupal, you can add a configuration to the
settings.php
file. Here's how to do it:-
Open the
settings.php
file for your Drupal installation. This file is usually located in thesites/default
folder of your Drupal installation. -
Add the following lines of code to the bottom of the
settings.php
file:
-