Skip to main content

Posts

Showing posts from 2016

Introduction About Drupal Console , How to install and use it

After applying these commands on your terminal , the command line interface (CLI) looks like this, (I am using Linux ubuntu os) If not then resolve the issues and warning Now the drupal console is configured on your machine successfully, so just download drupal-8 and install it on your machine by drupal console, # Download, and install Drupal 8: drupal chain -- file = ~ / . console / chain / quick - start . yml   # Create a new Drupal 8 project: drupal site : new drupal8 . first_project (Where first_project is the name of the drupal project)   # Lists all available commands of drupal console: drupal list                              

Naming Convention on drupal-8 module development,

Before going to start working on drupal 8, Today i will explain you the naming conventation of the drupal module development  First Step:- to create a new folder for new D-8 module,  sites/all/custom/{module_name} OR sites/all/modules/{module_name} That is the standard way to create custom module and themes, now choose the name of the module , Always remember module machine name and module folder name both are different thing, and we can choose diffrent foldername rather than same module machine name, lets suppose, my module folder name is sites/all/custom/ HelloWorld while my module machine name is hello_world, When we are going to choose the module machine name, there are some following rules to keep in mind, 1- module machine name always start with letters, 2- module machine name must contain only lower-case letters and underscores. 3- it should be unique , your module machine name may not have used in any module/theme or profile, 4- it may not have the some pres...

How to Import large CSV file in Drupal with Batch API , Beginners Guide Part I

Recently i have worked on a project which has lots of (in lakhs) data, I have a CSV file which we need to import in database, suppose the CSV have arround 2 lacks data, so when i try to import it then ststem consums too much time and gives the timeout error and failed to upload, to resole these type of issue the Batch API comes in My mind, Why use batch API, Batch API makes a queue of operations and performs each operations one by one, so system did not give the timeout issue, and batch API also shows the status of uploading and remaning data, Here i am assuming you have basic knowledge of drupal module development, Step -1 : create a module within your drupal application, Lets assume module name is dharmend, Now i am going to create a menu , so i have added hook_menu in module file <?php /* implement hook_menu to create a new menu, * */ function dharmend_menu(){ $items['csvImporter'] = array( 'title' => t('Upload Data Fro...

How to span column of custom table in Drupal

If you want to span the column of custom drupal table like below image, Follow the below code to make the header of the table , <?php $header = array('S.N','District', array('data' => '<div class ="house">Household </div><br><span>Rural</span> <p>Urban</p>','colspan' => 2), array('data' => '<div class ="house">Members</div> <br><span>Rural</span> <p>Urban</p>','colspan' => 2), 'Duplicate/Failed Registration', array('data' => '<div class ="house">Pending De duplication </div><br><span>Rural</span> <p>Urban</p>','colspan' => 2), 'Non Un-organised Workers', 'SSID Generated', 'No. of Card Personlised', ); $rows[] = arra...

alter edit form and attach the fields on edit form

if(arg(2)=='edit'){                                                      $prev_node = node_load(arg(1));                            $form['#node'] = $prev_node;                        } now you can get all the form field values on node edit form function create_agency_user_node_update($node){ }