- Drupal Developer helps you to learn Drupal by Live code examples!
- Learn to develop custom Drupal modules and themes for Drupal 5, Drupal 6, Drupal 7 and Drupal 8
- Post your Drupal questions and get solutions.
- It is always free to join and post!
CodeLet
Primary tabs
Drupal : Send Ubercart PayPal payment to node author
Submitted by DrupalD on
This CodeLet alter the 'uc_paypal_wps_email' variable when PayPal payment is enabled with Ubercart & sets to node author's PayPal account email address.
This requires creating a field on user's account with name 'PayPal Email' (field_paypal_email).
Drupal: Integrate A-frame & enable VR features
Submitted by DrupalD on
This CodeLet integrates Aframe libray & displays images using Aframe. With a VR enabled device, you can then view it in VR. It first displays a wall of images. When user clicks on one of them, on a new page, it displays the image using aframe library.
Drupal: Create Drupal7 node Programmatically
Submitted by DrupalD on
This CodeLet will read data from an external API, parse the JSON response & build a node of specific type. It imports taxonomies & images as well.
The fascinating thing about this CodeLet is, it can import data to multi - value node fields, including multi widget fields & different field types.
Drupal7: JSON, hook_form_alter & hook_menu
Submitted by DrupalD on
This CodeLet demonstrates the use of hook_form_alter & hook_menu.
Using hook_form_alter, a text field is added to site information page. Once a API key is saved, the button has value 'Update configuration'
Using JSON menu, one can pull a node of type page, as JSON string.
Drupal: Using #ajax on a form
Submitted by DrupalD on
This CodeLet will ajaxify the respective element and will trigger an event. Respective action will be taken by the code and displayed on the form within the specified wrapper
Drupal: Add products to cart programatically
Submitted by DrupalD on
This CodeLet allows to add products to cart from code. The current product uses an extra text field. The cart view has been modified to accomodate extra fields from the product
Drupal: Redirect user after login
Submitted by DrupalD on
This is just a two lines of CodeLet which allows you to redirect your users after they log in to your site. This not complex and super quick
Drupal: Change User account title
Submitted by DrupalD on
This CodeLet will change the title of the User account page. It will consider and set user's 'username' as the titlte of the account page. Drupal offers this by default. But this can be used when some other modules have already modified the title.
Drupal: Last Login details
Submitted by DrupalD on
This CodeLet will store user's login history and creates a block. Admin can place this block on user pages or on pages. Future ammendments to this code will allow to use the stored login details to be displayed using a theme function.
This CodeLet will be submitted to Drupal.org community soon.
Drupal: Set content in a region programmatically
Submitted by DrupalD on
This CodeLet will allow you to set some text in a region you specify from configuration page. The regions are from the current theme. The desired content will be displayed in the region when the page is rendered.