Class

JQuery: Get/Load Element by ID (or) Clases with spaces - Sample code

In Jquery we allowed accessing the element by its class or ID. If we use the help of class means the '.'(dot) followed by class name will help us to access the information. If we use ID means, the '#'(hash) followed by ID name help us to load the element object. The below is the accessing element property.

Drupal 8: Accessing Node values and properties by loading

The node object is loaded by the function load() of Node class of core Drupal system. The object of the node will hold the pieces of information like Content type, created timestamp, author and revision values. Similarly we able to access node field values. The below is the example accessing the Node properties field values of the node.

Drupal 8 formatPlural(): Formatting count sentances with Singulars and Plural

In English grammar, there is importance to display words with proper nouns. The Singular and Plural will help to display sentences with numeric count components. Singular means only one. Plural means more than one. In Drupal 8 we can format both singular and plural values by formatPlural() function of Transulation Modules.

Drupal 8 : How to use MERGE(INSERT+UPDATE) query with Syntax and Example

MERGE is the short hand Drupal database statement used to perform both INSERT and UPDATE functionality in same code. It Will check whether record is already exits with given condition, yes then update based on condition otherwise insert a new record. The merge() is a function of Drupal 8 core class used for MERGING record based on condition records. Below is syntax and example of how to use MERGE statements in Drupal 8.

Initial Table be like:

Related Blogs:

Drupal 8 : How to use DELETE query with Syntax and Example

Using the object of core Drupal class we can perform database queries. Delete is the data deletion query used to remove data from Database based on conditions. The delete() is a function of Drupal 8 core class used for remove records. Below is syntax and example of how to use DELETE query in Drupal 8.

Before Delete Table be like:

EMPLOYEE_ID EMPLOYEE_NAME EMPLOYEE_AGE
CE 001 Mohan 20
CE 002 Dinesh 17
CE 003 Kumar 25

After Performing delete Query table records like:

Related Blogs:

Drupal 8 : How to use UPDATE query with Syntax and Example

UPDATE is the Data Manipulation Language(DML) query in Database management system. Using the object of core Drupal class we can perform database queries in Drupal 8. Update is the data modifying query used to change data in Database. The update() is a function of Drupal 8 core class used for update records. Below is syntax and example of how to use INSERT query in Drupal 8.

Before Update Record in Table be like:

EMPLOYEE_ID EMPLOYEE_NAME EMPLOYEE_AGE
CE 001 Mohan 20
CE 002 Dinesh 17
CE 003 Kumar 25

 

Related Blogs:

Drupal 8 : How to use SELECT query with Syntax and Example

Using the object of core Drupal class we can perform database queries. Select is the data retrieval query that has been done with help of select() of Drupal 8 core class. Below sample show how to use select query in Drupal 8.

Output:

EMPLOYEE_ID EMPLOYEE_NAME EMPLOYEE_AGE
CE 001 Mohan 20
CE 002 Dinesh 17
CE 003 Kumar 25

Related Blogs

Drupal 8 : How to use INSERT query with Syntax and Example

Insert is the Data Manipulation Language(DML) query in Database management system. Using the object of core Drupal class we can perform database queries in Drupal 8. Insert is the data saving query used to store data to Database. The insert() is a function of Drupal 8 core class used for insert records. Below is syntax and example of how to use INSERT query in Drupal 8.

Before Insert Table be like:

EMPLOYEE_ID EMPLOYEE_NAME EMPLOYEE_AGE
CE 001 Mohan 20
CE 002 Dinesh 17

 

After Performing Insert Query table records like:

Related Posts:

Drupal 8 : Get Site Informations like Site Name and Site Mail ID with Code

In Drupal 8 site information's are stored in system.site config file. This information's are accessed from config() function with help of Drupal object. Basically this settings holds the information's of Site name, Site Slogan and Site Mail Id.

Drupal 8 : Custom Form Validate and Submit in hook_form_alter() with Example

In Drupal 8 we can able to call custom validate and submit function for our need. This custom functions need to be defined in hook_form_alter(). Validate is defined as array parameter for #validate key of $form array. Similarly for submit is defined as array parameter for #submit on $form submit action.