Skip to content

Instantly share code, notes, and snippets.

View rakeshjames's full-sized avatar
💤

Rakesh James rakeshjames

💤
View GitHub Profile
@rakeshjames
rakeshjames / example.module
Created October 1, 2014 11:49
Drupal 7 - Add a cancel button on node forms (How to add a cancel button on node form?)
<?php
/**
* Implements hook_form_alter().
*/
function example_form_alter(&$form, &$form_state, $form_id) {
// You might want to filter by content type.
if ($form_id == 'YOUR_content_type_node_form') {
// Add a cancel button.
$form['actions']['cancel'] = array(
@rakeshjames
rakeshjames / auto_load_block.php
Created October 14, 2014 09:37
Auto click or auto loading popup with colorbox drupal 7?
<?php
global $base_url;
print "<div class = 'auto-click'><a href='" . $base_url . "/video/1?width=500&height=500' class = 'colorbox-load'></a></div>";
if (!empty($_GET['banner'])) {
$thankyou = $_GET['banner'];
if ($thankyou == 'yes') {
echo "<script langauge='javascript'>
jQuery(window).load(function(){
jQuery('.auto-click a').click();
});
@rakeshjames
rakeshjames / example.module
Last active August 29, 2015 14:10
Drupal 7 How to add a button act like "Clear all caches" in the custom form in custom module? example
<?php
/**
* @File
* Example for button act like "Clear all caches" in the custom form in custom module
* @author Rakesh James
*
*/
/**
* Implementing hook_menu().
<?php
/**
* Implementing hook_form_alter()
* @param $form
* @param $form_state
* @param $form_id
*/
function YOUR_MODULE_NAME_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'views_exposed_form') {
$term_reference_tree_path = drupal_get_path('module', 'term_reference_tree');
server {
listen 80 default_server;
root /srv/www/drupal8;
index index.php index.html index.htm;
server_name YOUR_SERVER_NAME.com;
location / {
try_files $uri @rewrite;
}
name: Example Profile
type: profile
description: Example for profile creation in Drupal8.
core: 8.x
distribution:
name: Example Distribution.
dependencies:
- automated_cron
<?php
/**
* @file
* Enables modules and site configuration for the Example Profile profile.
*/
// Add any custom code here like hook implementations.
<?php
/**
* @file
* Install, update and uninstall hooks for the Example Profile install profile.
*/
/**
* Implements hook_install().
*
Node Js Tutorial study links.
https://blog.risingstack.com/node-hero-tutorial-getting-started-with-node-js/
http://www.tutorialspoint.com/nodejs/
name: Example_events
type: module
description: Example module for Event handling in Drupal 8.
core: 8.x
package: Examples