drupal

Drupa 8 Custom Drush Command

If you need to create a custom drush command here is how this example Sets the home page via path not via node id (this one uses another core drush command)

First you need a module and a file in it that is has .drush.inc at the end of it

Example mymodule.drush.inc

then you need to do some thing like this:

Drupal 8 WorkBench EventSubscriber Example

Drupal 8 Event subscriber example for work bench moderation module.
say you want to do some thing when a work bench state changes ... this will get the logged in user vs the node content creator and get there enmails etc.

Service File:

services:
  test_even_subscriber.default:
    class: Drupal\test_even_subscriber\EventSubscriber\DefaultSubscriber
    arguments: ['@current_user']
    tags:
      - { name: event_subscriber }


Drupal\test_even_subscriber\EventSubscriber\DefaultSubscriber.php

Drupal HTTPS Redirect Via .htaccess

So you got a ssl cert. and need to rediect to https ? cool in your Drupal .htaccess file do this :

  RewriteCond %{HTTPS} off [OR]
  RewriteCond %{HTTP_HOST} ^yoursite.com\.com*
  RewriteRule ^(.*)$ https://www.yoursite.com/$1 [L,R=301]

 # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Custom social share module d6 and d7:

Have a look at the bottom of this page ...see the social widget ?
well  it is a module  I made for  drupal 6 and drupal 7

That provides social like actions with little to no JavaScript overhead ... however it is 100% custom !

That means you can do whatever you want with it ... 

Want  10000000 likes on face book ? Just go type it in !  “Looks” like you are social media king !

Download:

Drupal webform in shadowbox

Some tims you want to make a webform in a pop up shadow box or light box ...well that is cool here is how you set that up:
1) Make the drupal webform the normal way and note the page id :
2) Copy your page-node.tpl.php and change it to page-node-YOURID.tpl.php (example page-node-38.tpl.php
3) in your themes template.php add this function so you can template pages by id: (change "themename" to your themes name)