logo

Blog

3 March

I was doing integrate razorpay payment gateway in Drupal 8 using custom code but we getting error like “Class 'Razorpay\Api\Api' not found” because razorpay library is not installed on server so follow this step to install using putty to run composer command.

In putty enter Server IP and port click on open

Then you need to enter those folder where your website exist for example I have website in public_html then I run following command

cd public_html…
				  

1 March

Page Template for Views Page

Published On: Mon, 03/01/2021 - 12:13

If you want to create template for views page like page.tpl.twig so you follow these step. Whole page template for views page.

Create copy of page.tpl.twig If your views url is ‘news-and-articles’ then rename file as ‘page--news_and_articles.html.twig’ and upload in your themes folder. If url has dash then replace dash with underscore.

After clear cache current template will work for this views instead of page.tpl.twig.

22 April

Custom code to add meta tag in Drupal 7

Published On: Wed, 04/22/2020 - 22:13

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');
  }

}

22 April

How to add Captcha in Webform in Drupal 8

Published On: Wed, 04/22/2020 - 22:13

If you have already created a webform then you can follow thi step 1. Open this url /admin/structure/webform (Structure -> Webform) 2. Click on "Build" in OPERATIONS column

3. Click on "+Add element" button, there will be seen a list form element

4. You can select Captcha from available list.

22 April

Set current date in custom form element in DRUPAL8

Published On: Wed, 04/22/2020 - 22:13

Set current date in custom form element in DRUPAL8

Add this line at top

 use Drupal\Core\Datetime\DrupalDateTime; 

Add the following code to your form

function HOOK_form_alter(…
				  

22 April

How to add condition in views with custom field in DRUPAL 8

Published On: Wed, 04/22/2020 - 22:13

If you want to add if condition in my "global custom text" field in views Drupal 8

Example 1: Check node status and put conditional link according to publish status

{% if  status  %}
   put your HTML as condition
{% endif %}

Example 2: In this example we are checking a field value is empty or not. according to value in we are showing link or status

{% if  field_final_layout_date is empty %}

put your HTML as condition

{% else…
				  

22 April

How to form alter of node page in DRUPAL 8

Published On: Wed, 04/22/2020 - 22:13

I want to change select list value in my state field so we follow the step My content type is 'project' so we can get the form id as 'node_project_form' I have a feild 'state' in my content type so field machine name is 'field_state'

function MODULENAME_form_alter(&$form, FormStateInterface $form_state, $form_id) {
	$dropdown_array = array('DL'=>'Delhi');
	if ($form_id == 'node_project_form') {
		$form['field_state']['widget'] = array(     
		 '#type' => 'select',
		 '#…
				  

22 April

Get user list by role programmatically in Drupal8

Published On: Wed, 04/22/2020 - 22:13

User this code before

use Drupal\user\Entity\User;

Thise code will be return user list of a given role (editor)

	$ids = \Drupal::entityQuery('user')
	->condition('status', 1)
	->condition('roles', 'editor')
	->execute();
	$users = User::loadMultiple($ids);
	foreach($users as $user){
		$username = $user->get('name')->value;
		$uid = $user->get('uid')->value;
		$userlist[$uid] = $username;
	}
				  

22 April

Set up Google plus login process Drupal 7

Published On: Wed, 04/22/2020 - 22:13

Pre-requisites: Google Developer Account Go to developers.google.com Open the api console From the drop down menu in the top left: Select Create Give the project a name Press Create Project The Project will be created and set to active Select API Access from the left menu Click the button marked Create an oauth 2.0 client ID Give the product a name and logo (whatever you want here) Select web application enter your site address click create client id You will need to edit settings here once…

22 April

Online Reputation Management

Published On: Wed, 04/22/2020 - 22:13

Online popularity control known as Online Reputation Management Company too is a key to success in online company. Why so? It is because it removes possibility for your company to earn bad name on the world wide web and increases your good picture through advertising good material relevant to your company. Under online popularity control assistance, everything published on the world wide web about you is considerably supervised. Content which contain harmful pieces of details are hidden on…