development

Force a guaranteed git pull success story

Sometimes you need to script a git pull or you just want to completely reset a repo to HEAD. You there are loads of errors git can throw you in the process; such as error: unable to unlink old 'sites/default/settings.php' or error: The following untracked working tree files would be overwritten by checkout. Below is my take on the complete repository reset/clean/pull. Let me know in the comments if you've got a better way or find errors I'm missing.

Programmatically creating nodes using Entity Wrapper

Creating nodes via the UI in Drupal is easy, creating or updating them programmatically(in code) has always been a tedious. I've nearly lost my mind staring into the depths of a dpm($node);

The problem was the lack of straightforward API to handle the field level CRUD. You had to manually shove correctly formatted data into an object, often by comparing against an existing node's array. The correct old process went(and still can if you want!) like this:

Subscribe to development