Latest Articles
Our latest news updates and insightful blog posts, designed to empower you with the knowledge and strategies you need to succeed.
How to design OMR Sheets using the OMR Software?
With the advancement of science and technology, the OMR industry too has experienced a major enhancement of the provided features. The traditionally developed OMR software was just used to read the OMR sheets that would be contributing to the effective checking and calculation of final scorecards. The user can conduct exams on a specific pattern of OMR sheets only.
Now, with the modification to the OMR software the user can easily design a vivid range of OMR sheets. OMR sheet scanning soft…
How to create user programatically in DRUPAL 8
$language = \Drupal::languageManager()->getCurrentLanguage()->getId(); $user = \Drupal\user\Entity\User::create(); // Mandatory. $user->setPassword('password'); $user->enforceIsNew(); $user->setEmail('email'); $user->setUsername('user_name'); // Optional. $user->set('init', 'email'); $user->set('langcode', $language); $user->set('preferred_langcode', $language); $user->set('preferred_admin_langcode', $language); $user->set('setting_name', 'setting_value');…
How to create or manage configuration form in Drupal 8
How to create or manage configuration form in Drupal 8
Create configuration form
create path in routing.yml, here my module name is "mymodule" so I am using it, you can use your module name.
mymodule.Myfiguration: path: 'myconf' defaults: _form: '\Drupal\mymodule\Form\MyConfigurationForm' // I have created form "MyConfigurationForm.php" _title: 'My API Configuration' requirements: _permission: 'mymodule dashboard_admin' // this is permission setting…
How to add condition in views with custom field in DRUPAL 8
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 %}
Complete…
How to add Captcha in Webform in Drupal 8
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.
How to access field value for a node in Drupal 8
Use this code at the top of your coding
use Drupal\node\Entity\Node //Working with nodes Load a node by NID:
$nid = 123; // example value
Method 1
$node_storage = \Drupal::entityTypeManager()->getStorage('node'); $node = $node_storage->load($nid);
Method 2
$node = \Drupal\node\Entity\Node::load($nid);
Get node's NID:
echo $node->id(); // 123Get node's bundle type: echo $node->bundle(); // 'article' e…
How render term field on node template in drupal 9
In Drupal 9, you can render a term field on a node template using the field_view_field() function. This function takes the following parameters:
Entity type: The type of the entity (in this case, it's "node").
Entity: The node object that contains the term field.
Field name: The machine name of the term field you want to render.
Display mode: The view mode you want to use to render the field (e.g., "full", "teaser", "default", etc.).
Here's an example of how to render a t…
How can run my code on user login Drupal 8
In Drupal 8, you can execute code before user login by implementing a custom module and using a hook to execute the code. Here are the steps you can follow:
- Create a custom module by creating a directory in the
modules
directory of your Drupal installation. For example, if you want to name your module "custom_login", create a directory named "custom_login" in themodules
directory. - Create a
custom_login.info.yml
file in your module dir…
How can get client IP Address in Drupal 8
I want to know IP Address of my website so can who is visiting or I want to location where is website visited using IP address.
Soln,
Add this code at top like other header
use Symfony\Component\HttpFoundation;
Use this code to get IP Address
\Drupal::request()->getClientIp()
Getting Error "CSV Serialization requires the League\Csv library" in Drupal 8
When I want to installed Views Data Export module to export CSV then we getting error as "CSV Serialization requires the League\Csv library"
We follow this step then I have installed module
1. Install module "Ludwig" module and enable the module
2. open this path "/admin/reports/packages" that will show missing library then you can download that library.
3 Upload required library in given location
4. Unzip that files and upload their all files and directory in /modules/csv_seri…
Get user list by role programmatically in Drupal8
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; }
Get URL parameters/argument in custom module Drupal 8
If you created URL with parameters in custom module as given example
http://localhost/drup/member/179
In example you need to access the value 179 in your code then follow these step
Use this line at top
Use \Drupal\Core\Routing;
You can use this code so its return all parameters but its return as object so again you need to load that object
You can use that code with named parameters as follows
$value = \Drupal::routeMatch()->getParameter…