Drupal Technical
| 7
min read
To load node details using its id in Drupal 8 uses the following syntax:
$node_details = Node::load($nid);
$node_details->field_FIELD_NAME->value;
We can load multiple nodes in Drupal 8 using load multiple() function. Note that the parameter should be an array of ids.
Drupal Technical
| 6
min read
I had a requirement to add a multi-level responsive drop down menu in a Zyxware theme. Please do refer the below reference links to know more about responsive themes and free Drupal themes. So for that I had to edit page.tpl.php, page--front.tpl.php, style.css, template.php etc.
First I added the following code to template.php of my theme. The steps that I followed here are,
Drupal Technical
| 1
min read
In Drupal 8, the usage of database operations such as select, update and delete are slightly changed from Drupal 7. The db_query() is deprecated in Drupal 8. To fetch a field we can use :
$query = \Drupal::database()->query('SELECT myfield from my_table where
field1 = :value1 AND field2 = :value2', array(
':value1' => $condition1,
':value2' => $condition2,
)
);
$data = $query->fetchField();
Now we can checkout the select, update, and delete operations in Drupal 8. For a field selection use,
Drupal Technical
| 3
min read
For upgrading any of your contributed Drupal 7 modules, you just need to follow the few steps shown below. First of all you have to make sure that Drush is installed. If not installed, follow the steps from here.
Drupal Technical
| 2
min read
In Drupal 8 we can load an image using image style in a custom function using the file id of the image. For this first, we have to create an image style by configuration or create a config file for the same (Example below: image.style.sample_image_style.yml). Note that we can generate the below file after creating an image style and export the same from config synchronization in Drupal 8.
Technical Solution
| 3
min read
While working on a project using git repository, if you want to create and switch to a new branch, then use: git checkout -b [my-branch-name]
To simply checkout a branch, use: git checkout [my-branch-name]
If you want to rename a branch when pointed to any other branch, you can type the following command: git branch -m [old-branch-name] [new-branch-name]
To rename the current branch, use: git branch -m [new-branch-name]
Drupal Technical
| 2
min read
In one of my work, there was a requirement to uncheck the option for 'Generate automatic url alias' checkbox for all nodes. I used the Pathauto module with version 7.x-1.2 for handling standard urls in the site. When changing a node title, its URL automatically changes. In case one forgets to uncheck the option 'Generate automatic url alias' in the node editing form, you can uncheck the option with the following steps:
Business Solution
| 3
min read
Introduction
A meal planning website in North America founded by one of our clients, is quite popular among its patrons in the US and Canada. The website built on Drupal 7 archives its recipes and help its subscribers to plan their family meals. This budget-friendly meal planning site can be easily personalized.
Drupal Technical
| 3
min read
A patch is a small file which shows what was changed in a repository. It shows the new changes in an existing file, details of the new files in the current directory, file deletion details etc. A patch file can be pushed to the git repository so that it is useful in the future for updating the changes in the corresponding file.
For creating a patch file in your current git repository, make changes in your files. Now open the terminal.
For unstaged changes, type the following command,
Technical Solution
| 8
min read
When you want to change from the black and white colors in your git, you can use the default git color configurations using the command:
git config --global color.ui trueThe --global is optional, if you want to make the coloring for the current repository, ignore this and type it as: