The Brightonart Blog is the collected musings of the team. Expect quite a lot about Drupal development and a smattering of other topics that interest us.

DOM ID encode PHP function

I needed to encode strings in a reversible way to be valid as XHTML IDs (letters, numbers, '-' and '_', must start with a letter). The following encode and decode functions do just that. If you are not using Drupal just replace drupal_substr() with your favourite multi-byte safe substr() function.


/**
 * Encode a string for use as a DOM id.
 * 
 * Replaces non-alphanumeric characters with an underscore and the hex representation of the character code
 * with letters in lowercase
 

Coq au Vin recipe

My manager at Red Bee Lefty asked me for this recipe before I leave the company this evening so I thought I would post it for others to enjoy!

Coq au Vin

Makes enough for 8

Ingredients:
Handful of Peeled shallots
Handful of Carrots 2cm chunks
Handful of Celery 2cm chunks
Button chestnut mushrooms ( or quartered bigger ones)
Handful of Baby plum tomatoes or cherry tomatoes
2 Handfuls of Baby new potatoes (or 3cm cubes of bigger ones)
2 small organic chickens chopped into pieces. I do two wings, 2 legs,

Override node reference select list options in node edit form

The requirement is to change the list of options for a node reference cck field to limit the select according to the user. Creating a hook_form_alter in a custom module and do dpm($form) there is no '#options' element in the field. This is because nodereference module adds it's stuff later in the form build process. However there is a way - like so often in Drupal it takes a few web searches to find - and that is '#afterbuild'.

In the hook_form_alter
$form['#afterbuild'] = 'my_module_custom_function';

Netsounds A/V Workshop

in

Gridio Interactive Audio Visual InstallationBrightonart presents the Netsounds audiovisual production workshop. This event is in association with Same Sky and occurs in the frame of “THE GREAT ESCAPE” Festival - Brighton UK.
More information about the workshop on the Netsounds website

Drupal Association Member

in

Drupal Association At Brightonart we have employed open source software in our projects since 1998. The benefits of open source are well documented and Drupal is a perfect demonstration of the power of a dedicated community to develop software which compares favourably with and surpasses proprietary closed source options. During the development process, when we identify required functionality which is general enough to be useful to the community, we release modules on Drupal.org

Soap Server for Services 3, Drupal 6

Drupal has been making waves in enterprise circles as the collective work of the community allows developers to prototype web applications very rapidly and move them into implementation with few extra steps.

At Brightonart we are being asked by our clients to make Drupal's library of UI tools available to other applications by connecting through web services such as REST and SOAP.

Taxonomy NCO AKA 'Matchy Matchy'

We've been working on an interesting new system over the past few years in the field of semantics.

It all started out with a big problem at the School of Everything. People were searching for music teachers and not finding people that had tagged their teaching profiles with piano. People looking for Martial Arts weren't finding teachers tagged with Tai Chi. The freetagging subjects vocabulary was getting out of control and the community was fragmenting as it expanded.

i18n_sync and i18n_helper

in

Our application has translated nodes with certain common fields synchronised using i18n_sync but we want the translation source node (in our case in English) to control these values and for them not to be editable in translated nodes. A real world example of this problem would be a product content type with stock code common to all translations.