Latest Articles

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

Get URL by Node id Drupal 8

you have to use following class

Drupal\Core\Url

You can use folowing code to get URL Alias

		$options = ['absolute' => TRUE];
		$url = \Drupal\Core\Url::fromRoute('entity.node.canonical', ['node' => $nid], $options);
		$nodeurl = $url->toString();

Get or Set config value programmatically Drupal 8

Get value of variable from configuration form

You can get config value in any custom code using following method

Example 1

$phone = \Drupal::config('socialmedia.settings')->get('phone');

In above example "socialmedia.settings" is const which has been defined in configuration form and "phone" is variable where stored value

Will get value which have beed set through configuration form.

Example 2

$slogan = \Drupal::config('system.site')->ge…

Get node id of current node page Drupal 10

	$node = \Drupal::routeMatch()->getParameter('node');
	if ($node instanceof \Drupal\node\NodeInterface) {
	  // You can get nid and anything else you need from the node object.
	  $nid = $node->id();
	}

Get installed a POS system to improve the business and manage accurately

A small store to a large retail store is advisable to use Point of Service systems to easily customize their routine operations. It increases productivity, business, revenue, relationship with customers, and also saves time efficiently. Free POS applications can be used in simple business procedures using existing tools where advanced system is not affordable. POS is connected with multiple computers, printers, scanners at the administrator, sales counter, and many more locations. If addition…

Get field value of reference node on node twig template Drupal 8 and 9

In following example field_course_ref is a field which reference with other node, field_course_type is a field of the reference content type which is a term so we get term name

{{ node.field_course_ref.entity.field_course_type.entity.name.value }}

Get error undefined method File::url() in Drupal 9

I was trying to create a custom banner based on user uploaded image in node then I got following error in Drupal 9 but it was workiing in Drupal 8

 

Following code I was using

$img_url = $file->url();

Getting this error

Error: Call to undefined method Drupal\file\Entity\File::url() in theme_preprocess_page() 

I found the solution its working fine in simply use createFileUrl(); instead of url();

 

Functions file_create_url() not working in Drupal 10

Functions file_create_url() was using to create url of images and files drupal 9 but now its not working in Drupal 10 so its deprecated now you can use code as follow to create url in Drupal 10

 

\Drupal::service('file_url_generator')->generateAbsoluteString($uri);

 

Used in Drupal 9 and beforeUsing Drupal 10
file_create_url($uri)\Drupal::service('file_url_generator…

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 browser
Login with password given by Airtel
Go to Services Tab

Service Tab Airtel
Click on Left Menu of Firewall then Firewal menu will d…

Found error "PHP EXTENSIONS Disabled" with Drupal 9 Installation

I got following error when installation Drupal 9

PHP EXTENSIONS Disabled Drupal 9

PHP EXTENSIONS
Disabled
Drupal requires you to enable the PHP extensions in the following list (see the system requirements page for more information):

  • gd

So re…

Essential Modules in Drupal 8

Pathauto

The Pathauto module automatically generates URL/path aliases for various kinds of content (nodes, taxonomy terms, users)

Requirements Token CTools

View Detail

8.x-1.8 Released 28 April 2020

ctools

ctools (Chaos Tool Suite (ctools))

Tools to make it easy for modules to let other modules

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 error

Drupal\Core\Entity\Query\QueryException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryI…

Display Fields Value in Drupal commerce product template in Drupal 8

How can display fields value in product template of Drupal commerce in Drupal 8

First have to create template with name "commerce-product.html.twig"

Some examles of fields value which can be use in template to display output

Display 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 imag…