Blog

By toswebdev, 29 August, 2022

There was a severe problem I faced the other day. I imported the configuration into my production environment. The configuration files I had saved for my module were overwritten by my development environment's configurations.

Information that needs to be synchronized between development and production is stored in configuration. When a site is being built, this information is often generated by the builders, not by regular users.

Instance-specific variables should be stored using the State API rather than the Configuration API.

By toswebdev, 9 August, 2022

WebP images have higher quality and smaller file sizes at the same time. This is what makes them great for use on the web where every byte counts, and Drupal 9.2 will support using WebP images out of the box. Let's see how we can use this image format.

The scheduled release date of Drupal 9.2.0 is June 16, 2021, and among many improvements and features is WebP images support. The original issue for adding WebP support was created a long time ago: Let GDToolkit support WEBP image format

Tags

By toswebdev, 4 August, 2022

Jenkins is a powerful application that allows continuous integration and continuous delivery of projects, regardless of the platform you are working on. It is a free source that can handle any kind of build or continuous integration. You can integrate Jenkins with a number of testing and deployment technologies. In this tutorial, we would explain how you can use Jenkins to build and test your software projects continuously.

Why Jenkins?

Tags

By toswebdev, 22 July, 2022

20 Git Command I Use All The Time — Git CheatSheet

So let's get started:

1. git init

This command is used to initialize a project as a git repository.

2. git remote add origin

Example:

git remote add origin https://github.com/example/Git-CheatSheet.git

This command is used to add or connect to a remote repository.

3. git remote

This command is used to view connected remote repositories.

Tags

By toswebdev, 10 July, 2022

The reset button in the form can be added directly in the buildForm method of the Form class or using a form alter.
 

 $form['action']['reset'] = [
      '#type' => 'button',
      '#value' => 'Clear',
      '#attributes' => [
        'onclick' => 'this.form.reset(); return true;',
        'class' => ['btn btn-warning'],
      ],
  ];

 

By toswebdev, 25 June, 2022

Let's start to use Service Container in Drupal. $container object stores services objects, it allows to execute of all needed actions for service objects in the constructor and passes ready to use an object in our custom module. For example, we need to write an SQL query to the database and we just call an object from Service Container to work with the database. This object will use credentials for database connection from our settings.php file and will connect to MySQL for the execution of our SQL query:
 

Tags

By toswebdev, 14 May, 2022

Twig's Extends allows you to inherit all the code from a parent template without having to duplicate it AND replaces parts of it (the parts in Twig blocks). You can only replace parts that are Twig Blocks. If you try and replace anything else in the parent template, you will get an error.

Twig templates can be extended with the following syntax -