Development

Code snippet: human readable to machine name

This PHP code snippet compute nice machine name (i.e. with only alpha numerical characters, keeping inside hyphens) from a formated human readable name.

Useful for some automatic machine name identifiers computing from human readable arbitrary titles, I use it sometime in Drupal modules.

<?php
/**
* Helper that generates a machine name using a provided human readable name.
*
* @param string $human_name
*   Human readable name.
*
* @return string
*   Machine name cleaned-up of any special chars.
*/
function human_to_machine($human_name) {
  return
strtolower(preg_replace(array(
   
'/[^a-zA-Z0-9]+/',
   
'/-+/',
   
'/^-+/',
   
'/-+$/',
  ), array(
'-', '-', '', ''), $human_name));
}
?>

System Theme 6.x-1.0 module released

System theme administration page with Slate theme

Today I released the System Theme++ module on drupal.org. This module is a simple administration theme admin page alteration. It allow site administrator to force Drupal to switch to administration theme on arbitrary pages.

Daily WTF

What The Fuck Cat

Today, I found the strangiest bug of the month; I was parsing some date parts with JavaScript to properly set default month of a YUI Calendar instance.

var month = parseInt(Drupal.settings.mymodule.date.month) - 1;
myCalendar.setMonth(month);

Why -1? Because month count starts with 0 in YUI Calendar, January is 0, december is 11; everything is fine until here.

Why the FUCK does my calendar always get to december?

Yamm development

I am currently writing a mass synchronization module for Drupal, based on eavy objects abstraction.
I will not describe it here, you can read the project page which describe pretty well how it works.

I wanted to do some notes about development context, and some other stuff.

Howto nicely theme Drupal node form

Drupal node form is not the most exciting user experience that Drupal may propose. If you are an experienced user, there is no need to worry, but in most cases, the sites you'll make with Drupal will be stupid end-user oriented.

With some minor custom theme alteration, you can easily provide the exact same form, but more "Wordpress-like", understand here, with a better organization and a more trivial visual schema.