Drupal

Drupal 8 : Get title and meta tags from Site URL using Ajax

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.

Drupal 8: Remove N/A option from radio button list options

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

Drupal8: Programmatically create a form and block

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.

Drupal8: Send E-mail after node creating.

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.

Drupal: Commerce buy now

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

Drupal: Pass ids as arguments to page VBO action

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.

Drupal: Using #ajax on a form

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

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: Display poll radio to Button and show result on click of choice

This CodeLet will Dispaly poll choice radio as a Button and view result on click of button.

Set user password using RULES

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.

Drupal: Import Vebra Property using Vebra API

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.

Drupal: Programmatically manage members of sub groups

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,
Ex. yourdomain/subgroups/$gid.

CodeLet Dependencies:
1-Organic groups ( og )
2-Subgroups for Organic groups ( og_subgroups )
3-OG Invite People ( og_invite_people ).

Drupal: Change User account title

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

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: Add product field on cart for Ubercart

This CodeLet let you display product field on cart page.

Drupal: Set content in a region programmatically

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.

Drupal: Remove tax line Item from Order Ubercart

This CodeLet let you allow Remove tax line item from order.

Install module and make changes as per instruction on CodeLet.

Programmatically create vocabulary

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:

Drupal: crowdsource features

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',

Download file and track of downloads by authenticated users.

This CodeLet let you allow a download file and track of that file.

Drupal: Redirct to node translation form

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.

Drupal: Custom node with hooks

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:
- hook_node_info
- hook_menu
- hook_perm
- hook_nodeapi
- hook_form_FORM_ID_alter

This CodeLet also creates an xml document which will then be used by the gallery to display images as slideshow.

Drupal: Add user avatar on registration page

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.

Drupal: Set any image as User profile image

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.

Track Drupal node visit

This CodeLet adds a tab on node page and display all the visits to the node by users.

Drupal: Make single checkbox a required field

This CodeLet will make a single checkbox a require field. This is usefule when you are creating a checkbox in your custom module.

Moderate Drupal comments automatically

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.

Generate Drupal sub sites automatically

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.

Drupal Search field tweaks

This CodeLet tweaks the way the search field is displayed in search block. It adds an image button instead of normal submit button.

Pages

Subscribe to RSS - Drupal