drupal7

Drupal Commerce: Get order quantity from order_id with sample code

In Drupal, commerce order contains multiple products. These products are attached to the line item to the orders. The line item table holds the information about the quantities and other information. The below is the simplest code to get the quantity of the order with different products.

Drupal 7 Commerce: Programatically adding the Billing and Shipping informations to Order

In Drupal, commerce order contains both Billing and shipping information on normal checkout process. If we are creating the commerce order programmatically then we have to add this information in manually. The below is the example of code for adding the Billing and shipping address to the order.

Drupal and security - Advice for Site Builders and Coders

The primary goal of this session is to give people a solid basis in the most common security issues so they can quickly identify those security issues. From there, we'll move into some other common pain-points of site builders like frequently made mistakes, modules to enhance security, and evaluating contributed module quality.

Drupal Coding Standards - do and don't

In each and every language there is a need of following coding standards. The Coding standard will differ based on each language. This article will demonstrate the coding standard we should following for Drupal Content Management System(CMS). This article compares coding standards for both Drupal 7 and Drupal 8 with some demos. Also, it will support the best approach to hack the Drupal Core and Contrib modules.

Drupal 7: CTools adding CSS to Modal window with example[ctools_add_css()]

In Drupal core the function drupal_add_css() help us to achieve adding CSS for a specific pages. The CTools modal popup will not support core drupal_add_css() functions. We have to use CTools functions for adding CSS files to modal window. The function ctools_add_css() will help to adding CSS files into modal popup windows. The function accepts filename, Module name and path for adding the CSS file.

Drupal 7: CTools adding JS to Modal window with example[ctools_add_js()]

In Drupal core the function drupal_add_js() help us to achieve adding JS for a specific pages. The CTools modal popup will not support core drupal_add_js() functions. We have to use CTools functions for adding JS files to modal window. The function ctools_add_js() will help to adding JS files into modal popup windows. The function accepts filename, Module name and path for adding the JS file.

Drupal 7: CTools Image button with Example [ctools_modal_image_button()]

The CTools not supporting normal l() function of Drupal, we need to use its own function for creating links and buttons. The below example will demonstrate about creating Image link button with an example. The function ctools_modal_image_button() used for creating image button by CTools.

Drupal 7: Programatically Creating CTools Buttons [ctools_ajax_text_button()]

The CTools plugin will not open with normal buttons and links. To open a page or form via CTools we need to use ctools buttons(ctools_ajax_text_button()). This ctools_ajax_text_button will create a link that contains the base class that help to pop up the pages.

Drupal 7: Commerce POS Accessing Order object

The Drupal Commerce Commerce POS module help us to achieve Point of Sale concept. The Drupal Commerce POS differs from normal commerce order. On Commerce POS they have implemented their own Order management rather than using Commerce Order. This has been achieved by its own interface and classes. On Completing each order, the order is again mapped to normal commerce order.

Drupal 7: Render Drupal system forms in custom module[drupal_get_form()]

The function drupal_get_form() is used to get the form details. Normally in Drupa,l the form field are constructed as an associative array. This associative array is defined inside a form function. The function name is the form ID, using this form ID we can able to render the form.

Drupal 7: CURL HTTP request with example(drupal_http_request())

The CURL is the PHP functionality for access external website contents. Using CURL request we can get content data, content or files from any other service providing websites. In Drupal 7 the function drupal_http_request(), will help to achieve CURL request for us.

Drupal 8: Adding custom CSS to form or page

The Drupal we can able to add custom CSS files to our forms. In Drupal 8 adding custom, CSS files will be achieved by using the library to system. The library files are needed before adding to form. These libraries descriptions are added in MODULE_NAME.libraries.yml files. Once libraries added we can able to define in our forms.

Drupal 7: Adding Captcha field in Node creation Form

The captcha will help to control bot and anonymous users content creation in websites. The captcha system makes will make a challenge for every user to confirm whether the user is human or not. These challenges are mainly used for avoiding spam content creations. In Drupal, there some contribute module will help to achieve captcha for Drupal sites.