Ignored By Dinosaurs drupal feed drupal Programmatically creating taxonomy terms in Drupal https://www.ignoredbydinosaurs.com/posts/287-programmatically-creating-taxonomy-terms-drupal <p>Because sometimes you need to roll out a bunch of taxonomy terms across 26 sites, and you just don't feel like clicking those buttons.</p> <pre><code class="language-php"><?php $terms = [ 'iReport', 'Infographic', 'Video', 'Case Study', 'Application Note', 'Data Sheet', ]; $vocab = taxonomy_vocabulary_machine_name_load('vocab_machine_name'); foreach($terms as $term) { $t = new stdClass; $t->name = $term; $t->vid = $vocab->vid; taxonomy_term_save($t); } </code></pre> <p>Save this to something like...</code></p> Wed, 15 Jun 2016 15:24:39 -0400 Migrating the Drupal public filesystem to S3 https://www.ignoredbydinosaurs.com/posts/286-migrating-drupal-filesystem-s3 <h3>Problemspace</h3> <ul> <li>You're working with a managed hosting provider and have begun to run out of room on the local/networked filesystem. Vendor wants to upsize your storage for a charge.</li> <li>You've got several different environments that you're working with (local|dev|prod|etc) and syncing the filesystem between them is an annoying chore in 2016. The various methods out there of proxying these requests don't really excite you.</li> </ul> <h3>Solutionspace</h3> <p>How about moving the Drupal filesystem up to The Cloud? ...</p> Wed, 15 Jun 2016 11:11:50 -0400 Programmatically creating image styles in Drupal https://www.ignoredbydinosaurs.com/posts/285-programmatically-creating-image-styles-drupal <p>Because sometimes you need to roll out an image style across 26 websites, and dammit you just don't feel like dealing with Features.</p> <pre><code class="language-php"><?php /** * Adds mobile_content_image style * * @param $sandbox * @return bool */ function hook_update_N(&$sandbox) { $style = image_style_load('mobile_content_image'); if (!$style) { $style = image_style_save([ 'name' => 'mobile_content_image', 'label' => 'Mobile Content Image (500 x 250)' ]); $effect = [ 'name' =>...</code></pre> Tue, 07 Jun 2016 15:35:55 -0400 Drupal Paragraphs - what is structured content? https://www.ignoredbydinosaurs.com/posts/282-drupal-paragraphs-what-is-structured-content <p>So I gave <a href="http://drupaldelphia.org/session/how-structured-content-and-paragraphs-module-reignited-my-drupal-flame">a presentation at Drupaldelphia</a> a few weeks ago about the <a href="https://www.drupal.org/project/paragraphs">Paragraphs module</a>.</p> <p>The Paragraphs module is my favorite Drupal module that I've come across in probably the last 5 years. It's basically Drupal's implementation of the concept of "structured content" - one of those terms that sounds so abstract that you probably feel an unconscious repulsion to even learning more about the idea, but hopefully I can help get you over that.</p> <hr /> <h3>The problem</h3> <p>The problem is the dreaded <em>body...</em></p> Tue, 26 Apr 2016 14:42:42 -0400 First steps with Drupal - content types https://www.ignoredbydinosaurs.com/posts/280-first-steps-drupal <p>See the previous chapter on <a href="/posts/278-installing-drupal/">installing Drupal</a>.</p> <hr /> <p>Hi there, and congrats on making it this far. You should be looking at a screen that looks like this --</p> <p><img src="https://dl.dropboxusercontent.com/s/3qzfwq4zbfm70eg/Screen%20Shot%202016-04-07%20at%2010.58.09%20AM.png?dl=0" alt="Drupal Welcome Screen" /></p> <p>Congrats, you've just set up a website with arguably the most advanced CMS in the world!</p> <hr /> <h3>Creating Content</h3> <p>This is what a Content Mnagament System is for after all. If you followed the "standard install", then you have a couple of different choices. In Drupal parlance, these are called "Content Types" and you have two of them so...</p> Thu, 07 Apr 2016 15:12:49 -0400 Installing Drupal https://www.ignoredbydinosaurs.com/posts/278-installing-drupal <p>See <a href="/posts/276-why-drupal/">the previous post in this series</a> on getting started with Drupal</p> <hr /> <p>So welcome back, this is actually the most challenging part of this tutorial - installing Drupal. I'm assuming no prior web development experience, so the first part will be installing something to run your tutorial Drupal site on.</p> <p>For this we'll be using a project called <a href="https://www.mamp.info/en/">MAMP</a>. MAMP is a package of software that makes it easy to set up Drupal (but not just Drupal) on your computer. I'll skip the deeper details for...</p> Tue, 29 Mar 2016 14:50:28 -0400 Why Drupal? https://www.ignoredbydinosaurs.com/posts/276-why-drupal <p>It's an interesting time to be building things for the web. It's matured to a place where much of our day to day lives is conducted through sites that we access online. I personally buy books on paper, diapers, any piece to repair a broken appliance. I search for clues on how to do my job. I read up on the latest state of th technology scene. Every one of these places I go has largely the same stuff on it - some kind of login, some kind of way to get to "my stuff", some kind of way...</p> Sat, 26 Mar 2016 08:38:56 -0400 Why Drupal 8 will fail https://www.ignoredbydinosaurs.com/posts/274-why-drupal-8-will-fail <p>I started working with Django last week. <a href="https://docs.djangoproject.com/en/1.9/contents/">The documentation is complete, organized, and located in one indexed portion of the website</a>. You can download a PDF of the entire thing and it's better than any O'Reilly book you could possibly buy about Django. If you land on a page for an old version of the framework, <a href="https://docs.djangoproject.com/en/1.7/contents/">it lets you know</a>.</p> <p><a href="http://www.postgresql.org/docs/9.5/interactive/index.html">The same thing goes for Postgres</a>.</p> <p><a href="https://symfony.com/doc/current/book/index.html">The same thing goes for Symfony</a>.</p> <p><a href="http://guides.rubyonrails.org/">The same thing goes for Rails</a>.</p> <p><a href="https://facebook.github.io/react/docs/getting-started.html">The same thing goes for React</a>.</p> <p>These are tools that want to...</p> Sun, 20 Mar 2016 10:51:53 -0400 Intermediate Drush Hacking - Drush Aliases https://www.ignoredbydinosaurs.com/posts/264-intermediate-drush-hacking-drush-aliases <p>There are other articles on this topic around the internet, but for some reason I could never completely make the mental connection on how Drush aliases worked until recently. It's actually really simple to get started, but most other articles tend to throw all the options into their examples so it kind of muddies the waters when you're trying to set yours up. By "you/yours", of course I mean "I/mine".</p> <h4>Simple</h4> <p>My work is an Acquia hosting client, and we have a multisite setup. Aliases...</p> Thu, 16 Jul 2015 19:21:00 -0400 The best, least understood aspect of Drupal multisite config https://www.ignoredbydinosaurs.com/posts/260-the-best-least-understood-aspect-of-drupal-multisite-config <p>We are currently running a Drupal multisite installation on Acquia's enterprise cloud. We have a bunch of different domains for the various sites, as well as the various environments in which they run. The development domains look like <code>pddah.dev.abm</code>, <code>pddah.staging.abm</code> etc, presumably to prevent them from being accessed from the outside world.</p> <p>This setup requires a rather voluminous sites.php file in the root of the <code>sites/</code> directory to map all the potential incoming hostnames to their...</p> Wed, 13 May 2015 16:34:45 -0400 Brain Dump - Drupal and Fastly https://www.ignoredbydinosaurs.com/posts/252-brain-dump-drupal-and-fastly <h4>Prelude</h4> <p>Fastly is a CDN (content deliver network). A CDN makes your site faster by acting as a caching layer between the world wide web and your webserver. It does this by having a globally distributed network of servers and by using some DNS trickery to make sure that when someone puts in the address of your website they're actually requesting that page from the nearest server in that network.</p> <pre><code>$ host www.ecnmag.com www.ecnmag.com is an alias for...</code></pre> Mon, 02 Feb 2015 17:33:00 -0500 Merging two Drupal sites together with Migrate Module https://www.ignoredbydinosaurs.com/posts/249-merging-two-drupal-sites-together-with-migrate-module <p><em>Notes from Mike Ryan, the Migrate guy, at the bottom. Make sure you read them before copying any of this code.</em></p> <hr /> <p>The Migrate module has some of the best documentation I've ever seen in DrupalLand, but there are still just a couple of things that I've figured out over the last month that I wish had been clearly explained to me up front. This is an attempt to explain those things to myself.</p> <p>Clearly, you're going to be writing code to perform this migration.</p> <ul> <li>There is a module - <a href="https://www.drupal.org/project/migrate_d2d">migrate_d2d</a>...</li></ul> Tue, 13 Jan 2015 15:41:39 -0500 Getting started with "Headless Drupal" https://www.ignoredbydinosaurs.com/posts/241-getting-started-with-headless-drupal <p>Hello there! There has been a lot of discussion in the Drupalsphere lately about a concept that has been coined "Headless Drupal", and rightly so. It's basically theming, but throwing out the theme layer. The theme layer in Drupal is very powerful, but has always felt severely over-engineered to me, especially in contrast to pretty much any MVC framework I've played with. With those, you define view-layer variables in a controller class, and you write HTML with a little bit of code to...</p> Thu, 02 Oct 2014 20:18:25 -0400 Drupal Angular tidbits -- multisite https://www.ignoredbydinosaurs.com/posts/238-drupal-angular-tidbits-multisite <h3>Exposition</h3> <p>One of these days I'll get around to writing the post that's been in my head for 6 months now about how to get up and running with Angular in a Drupal setting. Today is not that day, however.</p> <p>What I'd like to talk about today is a little hack that I came up with to allow me/us to maintain a single codebase to serve several different mobile apps.</p> <h4>Multisite Drupal</h4> <p>You're likely already familiar with this concept, and it has <a href="https://www.acquia.com/blog/power-drupal-multi-site-part-1-code-management">its proponents</a> and <a href="https://www.getpantheon.com/blog/drupal-multisite-not-enterprise-grade">its detractors</a>. The second (anti)...</p> Sun, 24 Aug 2014 13:57:10 -0400 The drush command 'mongodb-migrate-prep' could not be found. https://www.ignoredbydinosaurs.com/posts/237-the-drush-command-mongodb-migrate-prep-could-not-be-found <p>For some reason I got it into my head the other day to tinker around with MongoDB and Drupal, masochism I guess. Anyway, I finally had the opportunity to start tinkering with it last night.</p> <p>The set up was fairly easy - if you're on a Mac with Homebrew just hit up the josegonzalez builds of PHP5.5 and then <code>brew install php55-mongo</code> or something like that. Just <code>brew search php55-mongo</code> before you go blindly copying that command in.</p> <p>Making the connection between Drupal and Mongo was also...</p> Sat, 23 Aug 2014 17:09:10 -0400 Building a mobile app with Drupal and Angular (part 1) https://www.ignoredbydinosaurs.com/posts/231-building-a-mobile-app-with-drupal-and-angular-part-1 <h3>The beginning</h3> <p>I'll make the "what is Angular" part as brief as possible.</p> <p>Angular is a giant JavaScript framework from our friends at Google. It fits into a similar camp with Backbone, a framework that Drupalists will likely have heard of since it's included in D8 core. Angular aims to make it as easy as possible to build a single page CRUD app, and in my limited experience it succeeds.</p> <p>I've never built anything with Backbone, but have the Peepcode series on it, and have been working...</p> Wed, 12 Mar 2014 15:07:54 -0400 A Drupal Views epiphany https://www.ignoredbydinosaurs.com/posts/205-drupal-views-epiphany <p>There's a question currently on r/drupal that asks the question "What's the best way to get your head around Views?". There are many excellent answers -- "study the Views API file", "get to know the UI ", "fuck Views because it writes poor queries" -- but none of them, to me, really answer the question.</p> <p>Views, for the uninitiated, is the open source, community contributed module that is the reason Drupal is the powerhouse that it is currently. Yes, there are many excellent Drupal features...</p> Fri, 27 Dec 2013 15:35:00 -0500 First experiences with Drupal and HHVM https://www.ignoredbydinosaurs.com/posts/53-first-experiences-drupal-and-hhvm <p>After reading <a href="http://www.hhvm.com/blog/1817/fastercgi-with-hhvm">the news about Fastcgi support landing in HHVM</a>, I had to finally give it a try. I'll assume that you're at least familiar with HHVM and it's design goals, but if you aren't <a href="https://github.com/facebook/hhvm/wiki">the HHVM wiki</a> is a good place to start. In a nutshell, it's a new PHP runtime courtesy of Facebook that, if you can get it working, promises to run circles around any PHP interpreter currently on the market.</p> <p>So I came into work on Wednesday fired up to give it a try. I wasn't expecting anything at all,...</p> Fri, 20 Dec 2013 18:59:07 -0500 A few things a Drupal dev should know about Ruby https://www.ignoredbydinosaurs.com/posts/45-few-things-drupal-dev-should-know-about-ruby <p>Hi there, probably-front-end-dev-who's-met-and-used-Sass-and-likes-what-they-see. This is for you.</p> <h3>RubyGems</h3> <p>Sass is made out of Ruby - it's a very pleasant, general purpose programming language that's pretty easy to learn and like. Ruby has a package management system whereby libraries of Ruby code are bundled up into what's known as "Gems". Sass is a gem. When you install it, you get a couple of new executables to play with in the terminal, namely <code>sass</code> and <code>sass-convert</code>. The latter of...</p> Sat, 10 Aug 2013 03:40:24 -0400 On contributing to open source projects https://www.ignoredbydinosaurs.com/posts/44-contributing-open-source-projects <p>Whenever a new developer shows up in some online thread asking for advice on how to learn to code, the replies <em>always</em> include "find an open source project to help with". The 5th birthday of the Macintosh that I bought to learn to code is any day now, and I've just now worked up the chops and the courage to follow that advice. Here's what I'd say to a younger me.</p> <p>When people say that, it's usually really intimidating to think about. What project? How do I get involved? What if I suck...</p> Wed, 24 Jul 2013 15:24:16 -0400 Finding that pesky Acquia host entry for your development environment https://www.ignoredbydinosaurs.com/posts/38-finding-pesky-acquia-host-entry-your-development-environment <p>At my gig we host our sites on Acquia's dev cloud. The dev environment is pretty locked down, obviously, since you don't want multiple, publicly accessible copies of your sites floating around out there, especially when it could be in any state of brokenness at any given time. So the way we do it is to use <code>.dev</code> domains that aren't publicly routable via DNS. We have a big ole master hosts entry in the local network that takes any of those dev domains and routes them to the proper...</p> Tue, 21 May 2013 14:48:23 -0400 Altering the Drupal Password Reset process https://www.ignoredbydinosaurs.com/posts/40-altering-drupal-password-reset-process <h3>WARNING! D6 code ahead!!</h3> <p>As improved as D7 is, they don't seem to have caught on to this one, so maybe this will help those of you as well.</p> <hr> <p>The internet is surprisingly scarce on information about this topic. Maybe most people don't need to alter the password retrieval process, but I've got a client with a variety of different roles on their site. These different roles have different profiles via the <a href="http://drupal.org/project/content_profile" title="Content Profile | drupal.org">Content Profile</a> module. On account of numerous other account/profile management...</p> Mon, 10 Dec 2012 05:00:00 -0500 The thing about Drupal, again https://www.ignoredbydinosaurs.com/posts/122-thing-about-drupal-again <p>So here I go again. </p> <p>I've written at length on this blog over the years about Drupal. It's a great tool for getting things done right now. It's seen a huge uptake over the last couple years among government agencies and educational institutions, so being versed in Drupal development is a good career bet at the moment, meaning over the next couple years.</p> <p>In the longer term though, I see it as pretty shaky and here's why.</p> <p>Drupal's raison d'etre is that non-technical users (meaning -...</p> Tue, 25 Sep 2012 05:00:00 -0400 Drupal select list for the Form API - 50 states https://www.ignoredbydinosaurs.com/posts/219-drupal-select-list-form-api-50-states <p>This is the list I've spent a half hour hacking around in TextMate trying to figure out how to not manually build. Couldn't quite do it, so here it is, that you may find it and use it when building a Drupal form that has a select list of all 50 states and the District of Columbia.</p> <pre><code class="language-php">'#options' => array( '' => t('Please Select'), 'AL' => t('Alabama'), 'AK' => t('Alaska'), 'AZ' => t('Arizona'), 'AR' => t('Arkansas'), 'CA' => t('California'), 'CO' => t('Colorado'), ...</code></pre> Mon, 06 Jun 2011 18:43:56 -0400 Drupal 101 https://www.ignoredbydinosaurs.com/posts/163-drupal-101 <p>I've recently begun a new contract for a rather large Drupal site.  I was very excited to land this contract as it shall be my first bona fide "enterprise" contract and there's already a large amount of content on the site despite the company being rather young.  There are a <em>lot</em> of forms on this site with leads being transferred to a backend system that I'll probably never have anything to do with.  Anyway, I was excited to get a look in the back end of the Drupal portion of the site to...</p> Thu, 17 Mar 2011 05:00:00 -0400 Migrating the blog from Drupal to Jekyll https://www.ignoredbydinosaurs.com/posts/114-migrating-blog-drupal-jekyll <h3>Reasons for leaving Drupal, a preamble</h3> <p>I'd had this website on Drupal since some time in July. If you look through the <a href="http://ignoredbydinosaurs.com/archive/">archives</a>, you'll notice a relative dearth of posts from this time period. Drupal just has a way of sucking all the fun out of blogging. It's very, very slow for one thing. I had a lot of trouble integrating the site with the Disqus comment system that handled all of my Wordpress comments before I made the move so I was forced to use Drupal's comment system. I'd written...</p> Wed, 15 Dec 2010 05:00:00 -0500