The drop is always movingYou know that saying about standing on the shoulders of giants? Drupal is standing on a huge pile of midgetsAll content management systems suck, Drupal just happens to suck less.Popular open source software is more secure than unpopular open source software, because insecure software becomes unpopular fast. [That doesn't happen for proprietary software.]Drupal makes sandwiches happen.There is a module for that

static methods

Submitted by nk on Fri, 2015-01-09 05:27

Here's something I learned from Wim Leers: the static keyword has a bad rep in PHP but that's because static variables can be problematic. static methods, especially protected static methods on the other hand are useful to indicate and enforce a method not changing the state of the object.

Where does migrate in core stand?

Submitted by nk on Thu, 2014-11-20 22:48

Migrate is horribly broken! Migrate works awesome! Both are true. (Yes!) So Keith Dechant reported migrating a live Drupal 7 site to Drupal 8. Melissa Anderson is migrating a Drupal 6 site and gets mostly bugs. How is this possible? Well, Keith was coding his way around bugs, not just using what core provided (this should be obvious since we do not yet provide Drupal 7 sources in core) and Melissa had a site builder approach to it.

Drupal 8 critical issues office hours November 14, 2014

Submitted by nk on Wed, 2014-11-19 18:27

cilefen begin to work on the When a content entity type providing module is uninstalled, the entities are not fully deleted, leaving broken references issue. Turned out that a necessary dependent issue is already being worked on so he was able proceed well. I am reasonably confident this issue will get resolved in due time.

Adding comma separated username autocomplete to a D7 form

Submitted by nk on Mon, 2014-11-17 21:20

Today I needed to add autocomplete to a field that could contain comma separated usernames and obviously the requirements included autocomplete. I thought this problem must be solved already in the ecosystem and sure, Views has it already. So I have added '#autocomplete_path' => 'admin/views/ajax/autocomplete/user', '#element_validate' => array('my_module_usernames_validate') and then

function my_module_usernames_validate(&$element) {
if ($values = drupal_explode_tags($element['#value'])) {
// Good thing Views doesn't use the native constructor.

MongoDB and Drupal 8: what and why?

Submitted by nk on Sat, 2014-11-01 15:22

Now that we have a fairly good idea how Drupal 8 and data looks let's discuss what can MongoDB provide and why would you want to run it. In Drupal 8, every kind of data can be stored independently. I fully expect that people will indeed mix storages. For example, D8 by default runs a config query on every page to find the blocks to be displayed for the current theme. Again, by default, config entities are stored as serialized PHP arrays so the only way a query like that can run is to load every single block entity from the database and iterate over them.

Drupal 8 critical issues office hours Oct 24, 2014

Submitted by nk on Sat, 2014-10-25 20:46

This was our first critical office hours. webflo have forward ported a Views SA (turned out that Twig autoescape made short work of the security hole -- yay! so now it's just a test) and even past the office hours followed up with a patch that now passes. I will monitor the issue further and make sure it gets reviewed and committed.

Following up on Doctorow's keynote

Submitted by nk on Fri, 2014-10-03 02:14

You will often find the less you are allowed to do with a computer the more user friendly it seems. This is hardly a coincidence. You need to make your decisions on how much inconvenience you are willing to take in exchange for your freedom in computing. The first and most important step is to make these decisions deliberate. Perhaps after the keynote this necessity is clear.

What JS makes this monkey dance?

Submitted by nk on Tue, 2014-09-16 04:27

Today I found myself in a complex codebase and my ticket was: this JS on this old page makes the monkey dance, can you make it dance on the new page? Well, my JS knowledge is... limited but I have a really mean right click. So I right clicked and looked around the source Chrome showed me. There was a div with a class slideshow-node-embed-processed.

Drupal 8 progress from my / MongoDB perspective: update #29

Submitted by nk on Sun, 2014-09-14 22:47

Perhaps the most important development is the final naming of what was field/field instance in Drupal 7: in Drupal 8 these are configuration entities. The machine names are field_storage_config and field_config. There has been several renames but we have settled on these finally (although the field_config rename is not yet in). It does reflect the most important difference between them: field storage contains everything pertaining to the storage of the field. The things that do not change the storage of it go into the instance.


Submitted by nk on Wed, 2014-09-10 05:36

Or, languages are really hard.

So I was handing over some CSV export functionality to a client who loaded it into Excel as it is without using the import wizard. This resulted in misinterpreted UTF-8 as WIN-1252. I quickly wrote this little function to add a BOM (error handling omitted for brevity):
function uconv($text) {
$descriptorspec = array(array("pipe", "r"), array("pipe", "w"));
$process = proc_open("/usr/bin/uconv --add-signature", $descriptorspec, $pipes);
fwrite($pipes[0], $text);
$text = stream_get_contents($pipes[1]);

User login