Latest Articles

Our latest news updates and insightful blog posts, designed to empower you with the knowledge and strategies you need to succeed.

FTP or FileZilla not working with Airtel Broadband

Sometime we face FTP connection issue with AIrtel Broadband so follow this step to resolved this issue.Open the IP Address 192.168.1.1 in browserLogin with password given by AirtelGo to Services TabClick on Left Menu of Firewall then Firewal menu will drop down.Click on ALG Menu under FirewallThere will be appear screen of ALG Type now you can enable FTP from the listNow Click on Apply Change

Found error "PHP EXTENSIONS Disabled" with Drupal 9 Installation

I got following error when installation Drupal 9PHP EXTENSIONSDisabledDrupal requires you to enable the PHP extensions in the following list (see the system requirements page for more information):gdSo resolved the issue by following these stepOpen the php.ini which is located at c:\xampp\php\Find "extension=gd" in php.ini so you can found this line but its seen comment so you need to uncomment this line, to uncomment remove the ";" which is prefix with the line.Now save the file, after saving t…

Essential Modules in Drupal 8

PathautoThe Pathauto module automatically generates URL/path aliases for various kinds of content (nodes, taxonomy terms, users)Requirements Token CToolsView Detail8.x-1.8 Released 28 April 2020ctoolsctools (Chaos Tool Suite (ctools))Tools to make it easy for modules to let other modulesView DetailDownload Zip 8.x-3.6 Released 12 May 2021TokenProvides additional tokens not supported by core (most notably fields), as well as a UI for browsing tokens.View Detail8.x-1.9 Released 18 December 2020Web…

entityQuery not working return error in Drupal 10

Problem:I am using entityQuery to get Node by using following method $query = \Drupal::entityQuery('node'); $query->condition('type', 'tours'); // Limit the type of node to check $query->condition('status',1); $nids = $query->execute(); but its return following errorDrupal\Core\Entity\Query\QueryException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). in Drupal\Core\Entity\Query\S…

Display Fields Value in Drupal commerce product template in Drupal 8

How can display fields value in product template of Drupal commerce in Drupal 8First have to create template with name "commerce-product.html.twig"Some examles of fields value which can be use in template to display outputDisplay user name of product author{{ product_entity.getOwner.getUsername }}Display user id of product author{{ product_entity.getOwnerId }}Display Product title{{ product.title }}Display product image{{ product.field_image }}If you want to display all the data excluding some f…

Disable cache for specific page routing in custom module in Drupal 8 or 9

Example is mentioned below where I have created a path (/mycustompath) so I want disable cache for this page then I have add following syntax with my code in the file (mymodule.routing.yml) or in your routing yml file options: no_cache: 'TRUE' Complete example as belowmymodule.form: path: '/mycustompath' defaults: _title: '' _form: '\Drupal\workassign\Form\MyTestForm' requirements: _permission: 'mymodule custom' options: no_cache: 'TRUE'

Custom code to save value in error log in Drupal 9

To save values in the error log in Drupal 8, you can use the following custom code:\Drupal::logger('my_module')->error('The error message: @variable', [ '@variable' => $value_to_save, ]); In the code above, replace my_module with the name of your module, and replace The error message with the message you want to include in the log entry. You can include any number of placeholders in the message using the @variable syntax.The $value_to_save variable should contain the value you want to l…

Custom code to disable or hide Node Attribute or Tabs in Drupal 8 or 9

When you create or edit a node there is some default option or attribute in Node Form so we can disable or hide through custom code by using following code in our custom module.In my example trying to to through folrm_alter hook. Following code using hide URL Aliasing for the content type of Article. function MODULENAME_form_alter(&$form, FormStateInterface $form_state, $form_id) { if ($form_id == 'node_article_edit_form' || $form_id == 'node_article_form') { $form['path']['#acces…

Custom code to add meta tag in Drupal 7

In your theme's template.php file, you could add something like **//** * Implements hook_preprocess_html */ function THEME_NAME_preprocess_html(&$vars) { if (current_path() == 'my/custom/path') { $description = array( '#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array( 'name' => 'description', 'content' => 'here all description goes', ) ); drupal_add_html_head($description, 'description'); } }

Custom code on comment publish in Drupal 8

Custom code on comment publish in Drupal 8If you want to add your custom code on published of comment then we can use hook"hook_comment_update""$comment->isPublished()" will check comment in publishedFor example you want to send mail when comment published or unpublished so you can follow these stepOpen your .module file and add the following code, for example your module name is "mymodule" then function mymodule_comment_update($comment) { // This code will run on publishing of comment…

Custom code if else condition in twig template drupal 8

In Drupal 8, you can use the {% if %} statement to create if-else conditions in Twig templates. Here's an example:{% if condition %} // Code to execute if the condition is true. {% else %} // Code to execute if the condition is false. {% endif %} Replace "condition" with your desired condition to evaluate. You can use logical operators such as and, or, and not to create more complex conditions.Here's an example of how you might use this in a Drupal 8 Twig template to display a message if the…

Crreate user programatically in Drupal 8

Using following step and method to create user programaticallyMust be use this line in above the codeuse Drupal\user\Entity\User;I have added two extra fields in user account that is mentioned below.Phone - This is text type field. field_phone (Machine name)Subscribe - This is multiple select type field has machine name as field_subscribe. Following options inNow using following code to create user, fields name and their array element you have to use as your structure in user fields.  $sub…