Bronius Motekaitis on Twitter

Welcome to the homepage of Bronius Motekaitis

This site is to keep me up to date with myself, but you're welcome to follow along. Next time I go on a tangent, you may want to come with...

Easily create an Add Another Node link to a Drupal View header or footer

You've got your View, maybe it's a list of articles, and you want to provide the user with an "Add Another" link?

$links = array();
if (user_access('create event content')) {
$link = l('Add Event', 'node/add/event',
'query' => drupal_get_destination()
$links[] = $link;
if (user_access('create performer content')) {
$link = l('Add Artist', 'node/add/performer',
'query' => drupal_get_destination()
$links[] = $link;
if (count($links)) {
print "

" . implode(' | ', $links) . "


This provides two links. Stick it in a Views Header or Footer with PHP filter type. Adapt to your own needs.

Gonna have some fun now with new Drupal T-Shirts available at DrupalCon Austin 2014!

Kids: "HEeeeyy Drupal!"

"OH YEAH!" (in the voice of the famous and awesome 80s Kool-Aid man).

I had a wild hare and decided to put together some fun 80s-themed Drupal tshirts which will be available for sale online and at the DrupalStore at DrupalCon Austin 2014.  Come check it out, and tell your 80s friends!

Simply prepend Drupal theme_table() rows with $rows index

I wanted to most-simply make a CSV import-seeded array in a Drupal themed table for a preview. Then I was like, "Hey could I include the CSV line number (the array index) as the first column in the table preview?" Here's what I came up with:

Moving Drupal sites/all/files to sites/default/files

Quick note to say that yes it is possible to move an incorrectly configured sites/all/files into the normal, expected, best practice sites/default/files.  Here's how:

Chasing the bloat: Server hdd filling up to capacity with Drupal mysql replication binlogs

From the annals of "and exactly how did I for from Drupal develoer and site builder to server admin" comes this tale of a weekend gone to rot.

Short story: Looks like our MySQL binary log files are filling up and rotating out as they've been configured to do (1.1GB apiece), but our not particularly large nor heavily trafficked Drupal 7 site binlogs were rotating out ~10/day!  Do the math-- that's .. a big number of gigglebytes gone down the tube in a heartbeat!

Getting started with drush scripts

Drush .. scripts?  Like shell scripts?

What you're looking for is this drush command:

drush topic docs-scripts

I was really hoping to find something at the top of my search results for getting started with drush scripting, but alas, nada. I did come across a d.o issue thread between greg and moshe where I guess drush shebang scripting was first introduced. I love this community!

Solr Server, Index, Views, Search API, and big nasty errors when moving environments

Had some good work against Search API + Solr going locally, so I Feature-ized and pushed to a remote at Pantheon ..  . and crrhhkkkkkggghhkkttthbbbtt. 

What I've learned:

One line sed/grep to replace or remove all database table prefixes in your Drupal site dump

On an inherited project, firing up a new dev site in Pantheon, I have it in mind that I need to provide the Drupal mysql dump without the table prefixes this shared host user currently has.

  1. drush sql-dump > ~/migrate/site.sql

  2. sed -i 's/theprefix//g' ~/migrate/site.sql

  3. gzip ~/migrate/site.sql

Hope this works.  I mean, I hope this helps.