- 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!
This CodeLet set title and body field values using Ajax.
Place this CodeLet to your custom module file(.module) or Create a Custom module for Drupal 8 as per documentation https://www.drupal.org/docs/8/creating-custom-modules.
First of all add a field(field_link) to your content type. after that add an ajax to that field as per CodeLet.
Ajax example to replace multiple fields on ajaxCallback.
You set multiple fields value on ajax trigger in Drupal 8.
Use this CodeLet to remove "N/A" option from radio button list options.
Place this CodeLet to your custom module file(.module) or Create a Custom module for Drupal 8 as per documentation https://www.drupal.org/docs/8/creating-custom-modules
This CodeLet let you programmatically create a form page and render same form on a block.
Create custom module and follow CodeLet instruction to create a form and block programmatically.
This CodeLet Sends an email after a node of specific content type is created. The CodeLet uses Drupal8 API which sends and email upon node creation. This CodeLet implement hook_entity_insert & hook_mail.
Place this CodeLet on your MYMODULE.module file.
This CodeLet will redirect the user to checkout page when user clicks on 'Buy now' button on the product
Use the code and create a custom module
Make sure you keep the weight of the module high in "system" table
This CodeLet add already implemented "Pass ids as arguments to page" on VBO.
Place this CodeLet to your custom module, you can see the customization on Bulk Operations field on the image.
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
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
This CodeLet will Dispaly poll choice radio as a Button and view result on click of button.
This CodeLet allows to set the user password during Rule execution, the following process can be used.
a) create user entity ($newuser)
b) set a rules variable $password (use PHP code to generate a random string)
c) execute custom PHP which looks like
This way, you can also use the variable $password in say, an email to the user letting them know what their automatically generated password is.
This CodeLet allows you programatically import property to content type:
1. Install module.
2. Create content type with the fields to which you want to import.
3. you have to update KEY/PASSWORD for Vebra API and URL of property on Vebra.
This CodeLet let you Programmatically manage members of sub groups. also you can add sub group.
you can inviter/remove peoples of sub groups. Invitation will be sent by email.
after installation of this CodeLet you must have to pass the group gid on query string,
1-Organic groups ( og )
2-Subgroups for Organic groups ( og_subgroups )
3-OG Invite People ( og_invite_people ).
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.
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.
This CodeLet let you display product field on cart page.
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.
This CodeLet let you allow Remove tax line item from order.
Install module and make changes as per instruction on CodeLet.
In some situation, you module is required to create a taxonomy which the module use to perform other tasks/features it offers. This is when you can write a code to craete the require vocabulary in the module and make it availabel as soon as the module is installed. You can also add terms programatically to that vocabulary!
Using taxonomy_save_vocabulary for Drupal 5.x & 6.x and taxonomy_vocabulary_save for 7.x, you can create the vocabulary programmatically in your module.
Here is a Drupal 6.x example:
This codelet demonstrate different features required by a crowdsourcing site
Requires two roles 'requester' and 'bidder'.
This already include two Content types 'Request' and 'Bidder content',
This CodeLet let you allow a download file and track of that file.
This CodeLet redirects the user to translate the node in the specified lanaguge. This will reduce the efforts to click on the translation tab and can enhance to transalte the nodes in all the enabled langauges, one-by-one.
This CodeLet demonstration how to create a custom node in code and use different Drupal hooks to build different features.
The CodeLet implements following Drupal hooks:
This CodeLet also creates an xml document which will then be used by the gallery to display images as slideshow.
This CodeLet adds a field on Drupal registration form and allows the user to upload an avatar. This will be saved to user's picuture field on his/her profile. This will work only if 'Picutre' is enabled by the admin.
This CodeLet allows you to set any image associated with certain contant type to be used as user profile image. This CodeLet particularly uses 'galleryimage' content type.
This CodeLet adds a tab on node page and display all the visits to the node by users.
This CodeLet will make a single checkbox a require field. This is usefule when you are creating a checkbox in your custom module.
This CodeLet enables a Drupal site to moderate the comments automatically. Once a user's comment has been white lited, all his/her furture comments will be automatically moderated without admin to review them.
This CodeLet will generate the number of Drupal sub sites you specify. It requires path to mysql executable on your server. The sub sites will be pre-populated with an SQL file.
This CodeLet tweaks the way the search field is displayed in search block. It adds an image button instead of normal submit button.
This CodeLet let you konw how to implement ajax on field group multiple module.
"fgm_node_YOURNODE_form_group_YOURGROUPNAME" where "YOURNODE" will be the name of your content type and "YOURGROUPNAME" will be the name of your field group,
Given example is for text field, ajax call on blur event.