 Good morning All right, so it's 1045 we'll go ahead and get started This session is going to be sort of a fire hose of things that I wish someone had told me when I first got it started doing Drupal development I've spent a lot of years teaching people how to do Drupal development So I have a lot of tips and stuff that I've kind of collected from that But I've also spent a lot of time building websites with Drupal and I've learned a lot along the way And we'll talk about that and sort of my background a little bit My name is Joe Schindler or EOJ the brave on Drupal.org Twitter Pretty much everything on the internet. I chose this handle when I was in like high school And then it was awesome for a couple of years and now I'm like, oh, I wish I had chosen like Joe Schindler or something Is my handle? It'd be a lot easier I currently work for a company called Lullabot Lullabot does a a lot of Drupal work. We do Drupal consulting. We do training around Drupal We build Drupal websites pretty much anything Drupal related or it really web related that you need help with we can do that and then I also One of my primary duties at Lullabot is working on the Drupalize.me website which is a site that has a bunch of Drupal training videos and They Gratefully allowed me to be here today and speak about training in Drupal and getting to know Drupal better So, yeah, that's me So just sort of a quick outline of what I'm gonna talk about today We've got like 45 minutes give or take a little bit I'd like to leave some time for question and answer at the end But this is kind of what we're gonna talk about Why this session is important or why I think this was a good idea We're gonna talk about some of the like jargon or different terms that are important to know when you're getting to know Drupal We're gonna talk a little bit about I'm new to Drupal and some tips and tricks for finding modules for me This was something that was really it took a while to figure out Like there's a about a billion modules out there and it took a while for me to figure out How do I find the ones in this pile of crap that don't totally suck We'll talk a bit about setting up a local development environment and why that's important some trick tricks That I learned about doing that And then there's a section of this presentation that is literally like a fire hose of me being like Oh, yeah, I remember when I made that mistake. You probably don't want to do that We'll talk a little bit about the Drupal community and why that's important and getting involved with the community And then have some time for Q&A If you've only got five minutes and you would rather be off getting coffee or using the restroom or whatever it is You need to do this morning Stick around for this slide This is what you're gonna learn from this presentation. You're gonna learn that when you're learning Drupal Google is your best friend You can search for just about anything you need to know about Drupal and somebody out there has probably solved that problem or something similar already The trick is knowing what to search for when you search Google or Drupal.org or any of the other available assets And that's kind of what this presentation will be about is giving you some of the terms and knowledge that you need in order to search for things and find the answers that you're looking for If you're looking for an answer the answer to your question is probably there's a module for that and the module that you're probably looking for is called views There you go. Ta-da, you need know everything you need to know about building sites with Drupal We'll talk a little bit about that concept And then we'll talk a lot about sort of how I learned About Drupal through working with the community and this idea that Drupal is an open-source project where I Can basically copy and paste things that other people have done in order to learn how to do things That I need to do and some of how I solve some of my problems doing that So that's my five-minute pitch. You need to know how to use Google You need to know what to look for you probably need to look for views And if use doesn't do it just copy and paste something as somebody else did because it's open source after all The hardest thing about getting started with Drupal or any other like new thing that you're trying to learn is that you don't know What you don't know and that's what makes it hard to find the answers when you first come to Drupal You're like, all right, this is great. I'm gonna build a website and I need to add some content to my site But I don't know how to add content to my site. So you start searching Google How do I add content to a Drupal site? Finally you stumble across the word node and you're like, oh, okay. I get it I need to create a node to add content to my site But there's all these terms that we don't know and it makes it hard to find the answers that we're looking for In addition to not knowing terms to there's just a lot of basic concepts that you kind of stumble across When you're learning these things by yourself, I did a lot of my early Drupal development essentially in a black box I didn't get myself involved with the community. I worked for a small design company, but I was the only developer there I spent all of my time sitting in the cubicle not talking to anybody else and learning Drupal Sort of later on I got involved with the community I learned that I had actually learned to do a lot of things the wrong way and spent a lot of time Undoing the things that I'd previously learned in order to kind of do them the correct way But it was sort of this I didn't really know that I was doing it the wrong way because I had no idea that there Was a different way to do it So I said we'd talk a little bit about some of the jargon or different terms that I think are important for people that are getting Started with Drupal and things that I wish I had kind of understood a little bit better when I first got started with Drupal Granted I got started with Drupal about six years ago the first site I built with Drupal I downloaded a copy of Drupal 3 and Attempted to install it at that time you got a dot sql file that contained all of Everything for Drupal and you there was no like installer you just you know imported the sql file and great You've got a Drupal site now And I started to build the site and I said this is terrible So I deleted the site and I built it with mombo instead and it looked really flashy And then I had to edit the code and I realized this is terrible And kind of went back and forth between those two systems for a while Then I gave up on that and started writing my own because I was like sweet I learned enough php in my sql from hacking on Drupal and mombo that I could write my own system So I started writing my own system and then at some point I was basically just copying and pasting things wholesale out of the user module from Drupal because I was like this is great They do this really well And then I was like maybe I should just use that system And I ended up coming back to Drupal in like four or five and and made a lot of progress since then um And so some of the terminology and the way things that are done has changed a lot since then but it's still like Important concepts to know In Drupal there's this concept of Drupal core and contrib And so Drupal core is you go to Drupal you download the current version of Drupal in this case It's Drupal 7.something You go to the project page you download it you get the zip file you unzip it everything inside of that zip file is Drupal core And and kind of keeping that straight. There are different things in Drupal core There are themes that are part of Drupal core and there are modules that are part of Drupal core But understanding like I've downloaded this zip file and that is the piece of it that is core when people talk about it um Drupal core itself is both some modules that provide basic functionality um and Also just a library of functions and tools for developers to use in order to create their own modules and add additional functionality And then there's Drupal contrib contrib is pretty much anything else you download from Drupal.org that isn't Drupal core So additional modules that you plug into Drupal to extend its functionality themes that enhance how Drupal looks that kind of stuff Is all Drupal contrib And kind of keeping those things straight. We'll talk a little bit about that later on in the presentation Uh, there's the ubiquitous term in Drupal node Which kind of means a lot of things in Drupal and a lot of different things um When I first got started with Drupal I had this idea that I wanted to create pages and I would think a page is like The top corner of the website where the home button and the logo is all the way to the bottom right corner where the You know copyright line is and I was like, I want to create one of these a page But there wasn't really a way to do that and sort of kind of understanding The concept of nodes and you could create a node that was a page Um, and then this idea of nodes sort of just kept getting More and more complicated. Basically, um the more versions of Drupal that we've gone through Today for me a node is primarily a piece of content on my site It's not necessarily a page in the sense that it's not the logo in the top right corner all the way down to the copyright line in the bottom Right, um, but it's the primary piece of content on that page So I might be viewing an article on my site and the page is the entire web page But the node is just the article portion of that. So the title of the article the body copy image that goes with it Um, and then in in Drupal 7 we kind of took this concept of nodes and abstracted it even further And we've now got what are called entities And this is where it gets really confusing But important to know so Basically nodes or entities in Drupal combined with fields our Drupal system for Doing some kind of data mapping for creating the schema that will eventually become your website When I first started building sites with Drupal I essentially tried to create a node for like every single page on my site And I would do like I would create a bunch of articles that were nodes And then I would create another node that was a list of all the articles that I just created and I'd link to them And it was sort of every page on my site was one individual node and I later realized that I could use a node as sort of a basic type of data And you could have various types of nodes so an article node a page node when it became really powerful for me Was when I started to understand I could do things like have a node that wasn't necessarily A piece of content that someone would read but rather data that Drupal could use in order to map different Pieces of the site together so a good example of that is um You tend to think of nodes or content on your site as being like a page or an article But there's also like a staff biography Some or an author profile on your site and I started to get this Understanding that I could create an author's profile as a node And then link that to the article and sort of create these relationships Um, so nodes or entities are your sort of basic data type And then fields are what is used to enhance the data model if you think of an entity is basically just a blank shell That's like, okay. I can start putting Information here and then you can use fields to sort of create a schema for that data So for an article the example would be you might have a field for the title You might have a field for the body you might have a field for the person that authored this article Which is actually a reference to another entity, which is a author profile So you start using all this to create these maps of how of the data on your site That was a really important concept for me to figure out early on in Drupal So that's nodes Another one that we often see is blocks Um, this also I think can get a little bit confusing because in some ways blocks are our content as well But I tend to think of blocks as being either like secondary content things that I'd like to be able to reuse across the number of different pages Um, or even more than that I often think of blocks as kind of just being a really simple way to lay out things on a page Basically like take this piece of content and put it here I might have a block that has a node inside of it But basically think of a block as a reusable widget that you can place somewhere on the page Inside of a region in Drupal and it will contain some kind of content Modules of course, um, you'll hear this term a lot. There's a module for that. Um, got a problem. There's probably a module for that um modules are um Pieces of code that extend the Drupal core functionality This is a little bit misleading because there's actually modules in Drupal core like the node module for example, or the user module Are part of Drupal core. Uh, but then most of what you'll where you'll get modules is from contrib Um modules extend Drupal core's functionality by implementing what are called hooks Um, so another common term in Drupal that's sort of one of those once you're into Drupal You'll be like, oh, yeah, hook you use a hook for that when you first get started with Drupal You're like, all right. I need to write some code How do I do that? Uh, probably by implementing a hook um Modules are used to extend Drupal's functionality or to alter its existing functionality Um, it's kind of like you you always hear that people say there's an app for that You know, I want to I want to figure out how to take the train somewhere in munich There's probably an app for that. Um in Drupal. You'll always hear there's a module for that Another common term is themes themes are basically the html and css that make your site look The way that it looks Another term that is used a lot in Drupal is the word path And this gets used in a lot of different contexts. The one that it I think, um Has the most value in is thinking of the path as part of the url So if you think of um a url for your site, it's mysite.com slash about Drupal thinks of the path as everything that comes after the sort of top level domain part So everything after example.com slash Drupal considers that a path and it uses that path in order to Map all of Drupal sort of flow. So when you go to a specific path, it knows which module to invoke What code to call in that module eventually which content to display on the page and so forth Um, so that's what sort of the path does primarily um Paths in Drupal have the ability to be Changed so you can essentially set up an alias for a path and so you'll see this a lot where I want to create a about page um When I create that page it ends up with a path by default That sort of Drupal's internal reference for that piece of content or node that I just created that might be node slash two But then I can create a path alias for that path that allows me to say about The path about is exactly the same as node slash two And what Drupal will do is when I go to view that page at slash about internally It'll actually just replace the query string For about with the path of the actual node itself And from then on inside of Drupal and all the code that runs was like Oh, you're talking about the path that is node slash two When the browser is like oh slash about this is great. Thank you Um, so paths are become an important term um And I I thought that this one is a good to bring up because initially I would always think of paths as the url So i'm always searching for like how do I modify the url? How do I change the url of this page? But it turns out what I really wanted to change was the path Um tokens are another important concept In Drupal that ends up coming up a lot when you're first getting in building sites with Drupal Tokens are basically little um Tokens or sort of variables that you can place into text in different Form fields within Drupal that then get dynamically replaced with some sort of variable content a good example of that would be You wanted to have a a block on your site or or you know Maybe an email that gets sent out when somebody yeah, this is a good example Drupal sends out an email when you register for an account on a site That email is configured from a screen in the administrative interface where you enter in a bunch of text Then you can put tokens into that text and the token might be something like the email address of the person that just signed up for an Account so there's a token for like user colon email that will be dynamically replaced with my email address when I sign up But then these tokens can get a lot more advanced they can do things like say the username of the currently logged in user Or you know the current date and time I use this for you always have to put that copyright in the bottom right it's like copyright 2012 But then every year you have to go and update it so that it's relevant Just put a token in there that gets automatically replaced with today's the date and you're like all right. I'm always up to date But tokens are basically just little um snippets that you can put into text They don't work in every form field in Drupal But they work in a lot of them and when they do they'll say Next to that text area It'll basically give you a list of all the tokens that you can use within it If you have the token module installed This is a little bit confusing because the system that allows for this token replacement is built in to Drupal 7 But the ui or the interface that allows you to see what tokens are available still lives in contrib So that was one of those like aha moments It's like if I install this other module it exposes all of this additional functionality in Drupal that I didn't know Was there sort of under the scenes before? Another important term or thing to understand with Drupal jargon is IRC IRC I eventually found out stands for internet relay chat I initially thought IRC was kind of the scary place where people hung out and talked about arrays and SQL and that kind of stuff and I was like I'm going to stay away from there That doesn't sound like my kind of thing But really what it is is it's just a big chat room It's sort of the digital equivalent of what's going on right here Everyone's in a room. It would be very easy to sort of raise your hand and ask a question It's easy to ask to talk to somebody you can address them directly and so forth It was a big revelation for me was Essentially getting comfortable with logging into IRC and asking a question or just talking to people I logged in for years before I ever spoke up or said anything in the pound Drupal chat room on IRC I just hung out there and lingered and people would ask questions and I'd be like oh, I know the answer to that And then I'd be like oh, man I wonder how I solve this problem and I'd sit there and stare at IRC and watch Other people ask their questions and scroll by and then I'd go try to google my problem and figure it out And eventually I was like wait, I'm actually supposed to ask people these questions Um, that was a huge thing for me getting involved with Drupal and it actually Unfortunately, this is one of those things that took me a couple of years to figure out I like I said, I basically spent the first couple of years of my Drupal career working in a black box and I eventually For me, it was a courage thing. I knew about IRC I knew about sort of the community and that they're all everyone was out there But I kept thinking I had this idea that I couldn't ask my questions or talk to people until I was good enough at Drupal to be respected I'm not I don't I don't know what I was thinking to be honest But it kind of goes along those lines and eventually I just kind of went well I think I'm good enough now And I distinctly remember the first time I asked a question about Drupal. It was actually on the forum I was like, all right. I got this. Um, I can ask an intelligent question I asked a question about some php code and I was like, yeah, I totally got this. It'll be no problem The first like five replies to my comment were like, this is the worst code This is like totally the wrong way to do it. I'm like, oh, okay So then I disappeared again for another like six months or so. I was like screw that These guys are scary Eventually though, I realized that There were things to learn from that interaction like yes Whoever made those responses could have done so in a nicer way and not said this is stupid Um, they could have said this isn't the best way to do it Here's another way And I went back and I started to look at those conversations that I had with people and I realized that I could learn a lot from them you know, I have one of my earliest interactions with any like one individual from the Drupal community was again in this time It was an IRC and I was trying to figure out how to solve a problem with displaying a Basically a plural string that Um When you've got one member you have to write the word member But when you have two members you have to pluralize it and that basically add an s So it now says members instead of member and I was having trouble figuring out some logic around that and I posted an IRC and um It was kind of like hey, I got this solution does this seem right to you guys and um Nate Haug who I now work with and is a good friend was like, ah, actually that's totally wrong I mean it works, but you really don't need 20 lines of code to do that. Just call this function Uh, turns out Drupal has a built-in function format underscore plural that lets you pluralize words And not have to do anything other than give it a number and The like count and then the two words that you'd like to use I had no idea that this existed I spent probably a couple hours trying to figure out how to make this work for me Somebody else comes along and says oh just call this function It was awesome Um Since then and and sort of in more recent times I've found that a lot of conversation about Drupal is starting to happen on twitter as well And that's become a really useful tool for me. Um, I follow a lot of people on twitter that are also doing Drupal work and It's nice because I can learn information that I might not have known I wanted to know just by kind of following those twitter streams and seeing you know So-and-so is talking about this new module and so-and-so is talking about this thing that they just figured out how to do And I kind of filed that away as sort of periphery information But it's nice because I know a little bit of knowledge now So when it comes time for me to solve that problem, I can be like, yeah, I remember somebody else Was solving that and here's some of the words that I kind of remember. So now I know it's a google for So I highly recommend Following other Drupal people on twitter It's also a nice place to just sort of ask those questions too Like, um, does anybody know if there is a module that performs this task? Does anybody know of a format that lets me easily or a function that will let me easily pluralize words? Um So that's some of my basic jargon. One of the things with Drupal is that there are a ton of um Terms that I often feel like we're just sort of made up like someone was like well We need to call this piece of code something Let's call it node Okay, um, and and sort of figuring that out that those things exist Um, I I can't go through all of them here Drupal.org has a good glossary It's actually huge and there's a lot of terms in it that are like, yep I totally know what the internet is. Uh, you don't need to have that in here Um, but there's also some really good information in there as well Okay, so after you've kind of like done your google search and you figured out here's my problem Here's what I need to do You need to pick modules Early on when I first got started with Drupal picking the module to do something was really easy All you did was download an entire cvs checkout Of the contrib repository and go to the modules page and turn all the modules on And then just see if one of them does what you needed to and it was awesome You could look at all there was, you know, maybe like a few hundred modules at that time Now there's like I there's a pile ton of modules. I don't actually know how many there are But I'm guessing it's roughly 1.6 billion at this point There's a ton of code in Drupal contrib the tricky part is That code is in all sorts of various states of complete and various states of usefulness And so one of the things that I had to learn how to do early on was figure out how do I sort of Figure out where's the needle in this haystack? And so I have some things that I kind of along the road figured out one of them was this Being comfortable talking to people in the community so By far the best way to figure out what module is going to help solve your problem is Ask someone find someone that you trust and ask them ask an irc Ask someone in the room at a conference like this Um There are so many modules out there that it's it's pretty much impossible for one individual to go through and evaluate every single one And so the best and surest way to find out about other ones is ask people that maybe have looked at one that you haven't It doesn't necessarily mean talking to an individual person either. There are a lot of sources for um figuring out Sort of what's out there that aren't people but could still be Entities in a sense that you trust At lullabot, we do a module monday. So every monday on the lullabot.com blog We post about a new module that someone at lullabot has used recently and said hey, this was useful for this particular task Um, I work with everybody at lullabot. I know them pretty well. I trust most of them Um, and so depending so if the module comes up from that source I'll probably trust that it's going to work and do what I needed to and and so forth Um part of what you're dealing with is with all these modules is like They're third party code. They're written by someone that you don't know. They've been uploaded to drupal.org pretty much Anyone can write code and upload it to drupal.org. There's a process that you have to go through to get an account Um, it takes a long time and it's kind of tedious, but pretty much anyone can get an account Once you've got an account, you can just go ahead and start creating projects on drupal.org and so You end up with a lot of modules that are things like I had a particular problem that I needed to solve for Joe's awesome website about unicorns I needed a Module for counting number of horns on unicorns and it was really useful for my website. I wrote the code I uploaded it to drupal.org and it's great There's this module up there and you can use it And it solved my problem really well, but it maybe didn't solve other problems. They're the code may be buggy It may be totally worked for my one scenario, but maybe full of flaws for something else It may be full of security problems and so forth. It's so it's important to remember that code on in drupal contrib is added by Essentially people that you don't know and so being able to evaluate and figure out what of the should I trust is important Searching drupal.org You can now on drupal.org. You've been able to do this for a while, but you can order by the most installed When you perform a search one of the facets that you could use when searching is order this list by most installed And one of the things that I eventually learned about This most installed is that it's not actually I initially assumed this was just like a download count So you click every time somebody downloaded views. It was like hey somebody downloaded views It must be more installed than other things that are less downloaded It turns out that this is this most installed is actually pulled from Drupal which will If you allow it to will phone home Periodically and say here's a list of all the modules that are on this site in which version and so forth It uses that in order to check for its security updates But one of the side effects of that is that like maybe side benefits will say one of the side benefits of that Is that drupal.org has a pretty good idea of how many sites out there are using any particular module So that can be useful in evaluating Because it most likely if a module has a lot of installs and a lot of people using it It probably does what it says it's going to do and it probably does it well Once you find a module The page looks something like this. There's a bunch of information on it this One of the things you'll see for a module is this list of like recommended releases and what you're going to download I initially was always I would come here and I would download whatever was in the green line Every single time hands down. I would download whatever was the recommended release I would download and install that and I would just stay far away from everything else Thinking that just because it's in red or in yellow means I shouldn't or couldn't use that But later realized that that's not necessarily always the case and this is a really good example This is for the the views module and you've got two Um versions for when you've actually got three versions here for Drupal 6 the 2.16 This 3.0, which is in yellow and then the dev version down here And my initial reaction to this was always like use the one under recommended releases 2.16 I would use that and stick to it and I would just kind of stay away from the other ones But now like there's this 3.0 version of views For Drupal 6 It's listed under other releases and so I kind of was like there must be there for a reason But I don't know what that reason is and The reason that it's there is because This is something else that you may need or want to check out You don't necessarily need to just stick to the green or recommended release for any particular module Try out the other releases in this case like the 3.0 version of views is pretty different than the 2.16 version and actually It turns out it makes the process of if you've got a Drupal 6 site upgrading to Drupal 7 A lot easier if you're using the 3.0 version of views for Drupal 6 Initially, I would have just stayed away from that. Another thing that I learned too was Sometimes development versions of a module Actually contain fixes for things or new features that I need for my site that I That weren't there initially and I sort of stayed away from these a lot And then I kind of learned it was okay to download and start using a development release With that understanding that what you were doing was downloading and using some code that the person that maintains the code Hadn't totally signed off on yet and said this is an official release Which I think is an important thing to keep in mind when looking at these module pages is that every single module on Drupal.org has a maintainer And that maintainer Well, so the example here is project information It's things like maintenance status development status. So like what's the status of this module As a module maintainer, I can click edit on this page and I can change maintenance status to whatever I want to change it to And so my definition of actively maintained may be very different than somebody else's definition of actively maintained So keeping that in mind There is no metric running in the background saying oh, there were x number of commits in the last You know 24 hours this project must be actively maintained. No, this is just somebody checking a checkbox And if it's one of my modules, I probably checked the checkbox like two years ago And then never came back to that page again So it's actively maintained because I checked that checkbox, but I actually haven't been back in a long time So keeping that in mind um We talked a little bit about like IRC and the community and that and So forth and sort of asking people that you Trust about modules another good way to evaluate a module is look at who Who's worked on that module is the person that's worked on this someone that I trust um If it's a you know a module written by someone like merlin of chaos in this case, um, he's written Obviously views which everyone uses and so I go. Oh if you wrote another module, it's probably fairly useful And it probably works pretty well because I know views works well and is well maintained and so you can sort of start to create these ideas or sort of Figure out which modules are going to be better than others based on who wrote the module Um, another thing that I learned was I used to if you see down at the very bottom of this box This says bug reports 692, um open bugs I used to come and look at this page and I would be like, oh man the views module has 692 bugs there is no way I am downloading installing that module um Like that's 692 known problems with the code Um, eventually I learned that 692 bugs and just looking at that number by itself wasn't really a good metric And it gives you some idea that there's a lot of known problems But you also have to understand that all of those bugs aren't necessarily bugs like somebody maybe filed the bug report That wasn't actually a bug like you know, they maybe said this word you spelled the word the wrong and and filed the bug report To fix it where it's not necessarily a bug that's going to affect the performance of the module on my site You also need to do things like look at the number of bugs total in this case like 6,500 Um, so that kind of it becomes a better metric there. I can see there's almost 700 open But there's 6,000 of them that have been Solved already. So that's a nice metric of like hey someone's actually working on this and fixing the problems Um, so my tip there was don't run away just because the module has bugs Um A they might not really be bugs b the bug might not affect Whatever you're trying to do with the module it may be over in some little dark corner that you're not using at all Um, and then it can just be a nice metric for that Um Sometimes the best solution is not one specific module, but it's actually a bunch of modules I used to uh Search for modules on drupal.org and it's like okay. I need to build a photo gallery on my site So I'd start searching for the photo gallery module and I'd eventually find joe's awesome photo gallery module And I download it and I'd install it and it would build joe's awesome photo gallery module And it kind of worked uh or it worked well enough and it gave me a photo gallery But it wasn't exactly what I was looking for so then I'd go in and I'd start modifying the code for the module I'd make it do what I needed it to do You know, maybe I needed the photos to pop up in a little light box So I'd make those changes And I'd submit a patch and the module maintainer would be like well Thanks, but no because on my site the photo gallery looks like this and things don't pop up in a light box So thanks for the patch, but no, uh, so now I was using a module and I had to maintain this all this hacked code One of the things that I actually took me a long time to figure out in drupal was this concept of um Modules that all worked and played together in order to build a greater solution Views is a really good example of this and then in conjunction with things like the field system But this idea of a lot of separate modules that played together nicely in order to allow me to build a photo gallery And then I can get a little bit tricky to figure that out because now I'm no longer searching for photo gallery What I'm searching for is module that lets me make a list of things Module that lets me resize images and twist them around module that lets me display things in a pop-up box But for me having that understanding that if I could take the idea of what I'm trying to build and break it down a little bit Then and search for sort of each of those individual components sometimes not always that would work better My suggestion would be Whenever you can in drupal build a solution using tools like views And fields and sort of the piecing it together method versus the downloading one giant module that does everything I tend to go the Build it myself route because then I can build exactly what I want to build rather than whatever someone else thought a photo gallery should look like And finally just download and test some modules Your you know you start searching your search result returns 10 different modules that all do essentially the same thing At the end of the day download it Turn it on if it does what you need it to do. That's awesome. You should use that module um One of the things that I sort of figured out doing development was the importance of being able to test modules In a place that was not my live website And this is interesting. You know back when I first started doing drupal you Downloaded the code you installed it for me. It was I would download the module to my local I would upload it to my server using ftp and then I turned the module on and see what happens And it sometimes worked and it sometimes didn't and that was what ended up biting me was the it sometimes didn't work but so I would I told you I worked in a black box learning this stuff But I the only way that I knew how to sort of turn a module on was get it into the drupal site And you turn it on and I didn't know anything about setting up a server or so for so I just had the web server and would upload things and for the most part it worked great Every once in a while you'd come across the module that was just totally busted Um, you know, maybe it has like an error in the php and all of a sudden I've turned on this module That keeps me from getting to my site at all and turning anything on or off and you're pretty much screwed Um, so when you're doing this process, um set up a local development environment What turns out is actually really easy these days The there's a bunch of ways to do it, um Probably the easiest way at the moment to get started with drupal 7 is to download the aquia dev desktop You just go to their site download the dev desktop. It's a one-click install It sets up all of the mysql apache php stuff that is necessary in order to run a drupal site And then it asks you would you like to create a drupal 7 site? And you're like heck, yeah, I would and what would you like the admin user to be and you're like I'd like it to be admin. What would you like the password to be like? It's also be admin Um go and then 30 seconds later. You've got a drupal 7 site that you can start installing modules on and playing around with Um, if that doesn't sound like your cup of tea, there's a lot of other options um mamp and wamp Mac apache mysql php or windows apache mysql php or lamp, which is linux apache mysql php There are a lot of solutions out there for sort of a one-click install to get a development environment set up Which means there is absolutely no reason That you should be testing things on anything other than your local development environment. I kind of learned that the hard way Um So this part is kind of the the fire hose of like I was trying to come up with What are all the things that I totally messed up when I started learning drupal? So get ready. This is it You spend a lot of time finding a module and you needed to download it and test it out or install it on your site When you download modules and install them on your drupal site put them in these sites all modules directory Not in that nice shiny directory that says modules right in drupal's root directory You can put them there and they will totally work Um, and then you can put more of them in there and it'll totally work and it'll keep working There's nothing preventing you from doing it The problem comes when it it's time to upgrade later Or when you need to figure out like which of these modules are drupal core and which are ones that I downloaded Which of this code is something that I wrote myself. Um, I learned that Keeping things organized was really really important When you first start it's like you've downloaded drupal core and it's all nicely organized But pretty soon you're adding a bunch of additional things to it and being able to keep track of what you added So and then also within what I've added Is it something that I got somewhere else from drupal contrib for example, or is it something that I wrote myself became really important So put all of your modules not in the root modules directory inside of these sites all modules directory Same with themes and so forth Another common practice is inside of the modules directory. You can actually Create any level of nested directories inside of that as long as so drupal will basically find sites all modules And then just scan through it recursively until it finds code that it can load and do something with So creating a directory for contrib and a directory for custom is really common practice And sometimes I'll even go beyond that and break it up into like even more nested structure, but it helps me keep things organized Um, another thing that I learned about drupal was that if it's not working, it's probably the cache So a really really good step for debugging any problem with drupal is um Well, okay So the first step is make sure that you're not actually just refreshing a screenshot of the website because I've done that You change the css refresh refresh nothing happens. You change it again refresh refresh. What is going on clear the cache nothing happens Ah, uh, so make sure you're not refreshing is a jpeg of the site after that Drupal has this concept of a cache that it uses for all kinds of different Things and so clearing the cache can a lot of times clear up some of either These little problems that you're kind of like this didn't exist An hour ago when I was trying to figure this out or just before I installed this module Like I can't quite figure it out. What's going on here always start with clearing the cache And this will do things like clear out drupal's Cache of like the modules that it knows about and that are enabled it'll clear out its css and javascript caches It'll clear out its list of all the known paths in drupal. It'll clear out its list of all of the Values for replacing tokens. Um, so a lot of these things that are sort of Um, important to the way drupal works get cached so that it doesn't have to do it over and over and clearing that out can help a lot Um, keeping your code up to date is really important. Uh, you downloaded drupal core You downloaded, you know, seven dot one six Eventually seven dot one eight comes out and you need to install that or you've got a version of some module Then a new version comes out. Um, you need to update that This is really important to do But it's not like Life or death. I need to do this As soon as the new module comes out. I used to think that anytime a new version of drupal came out, I needed to stay up all night and Update every single one of the sites that I was responsible for Uh, which at the time like the company that I worked for had a lot of smaller sites And so this would be like, you know, all right drupal 6.5 came out I've got to spend the next 24 hours updating every single one of these sites And I need to do it right now. Otherwise, they'll probably catch on fire Um, but the truth is they probably won't catch on fire and you don't always need to do it right now And that was an important thing for me to figure out was that it's okay for me to not perform an update immediately As long as I understood what that update or why there was a security release for this piece of code So you can find out about security releases from a number of different sources I find the best one to be following the security mailing list Um, you just sign up for the mailing list anytime. There's an announcement about a security flaw in one of the either drupal core or drupal can trim You'll get an email and it'll tell you this can be a bit of a fire hose security announcements come out on wednesday and like wednesday afternoon my inbox will fill up with security announcements And then I go through it and I go not using that module not using that module not using that module not using that module Sweet. I'm done Um, so but it is important to go through and read them all and see if it's a module that you're using or not Drupal makes this easier by having a a system that allows it to phone home and tell drupal.org The list of modules that your site is using and which ones are enabled in which version of that module I would encourage you to turn this functionality on and one of the things that I Learned later was that um, you can actually have the system email you anytime there are updates to one of your modules Which is is both really nice and can be really annoying We said that you know, it's not always important to update right away But if you don't update right away your website will email you all the time telling you to update and eventually it's like the um The confirm page right you go to delete a user and it's like are you sure you want to do this? And you're like yes, and you go to delete another one It's like are you sure you want to do this? Yes, and eventually you just like train your brain to click the confirm button Um, I've eventually just sort of trained my brain to delete The update notifications that drupal sends me and then realized. Oh, that's probably not the best way to do it Um, another way to get these this information is following. Um, drupal security on twitter Read these announcements and understand when I'm using the Views module and there's a security release for that module. What is it actually fixing and does this Apply to me and do I need to update right away or not? And those announcements contain a lot of information that you know, they contain a severity level like this is highly Critical that you update versus like if you get around to a great if you don't you're not going to die um And so understanding that because a lot of times security issues aren't aren't necessarily Exploitable by the general public The majority of security issues end up being exploitable by someone that has a certain set of permissions on your site And they generally relate to things like if you're an administrator And you can log into the site and you have this specific permission to view this page And you edit this field and enter this text into it. There's a security problem If I'm the only person that can administer the site, um I don't necessarily need to update the code right away I just need to not go to that text field and type that stupid code into the field Unless I want to verify that it is actually a problem Um, what you should do on your local development environment But understanding that was important for me Because like I said, I would kind of stress out and any security releases come out on Wednesday So it's like Wednesday nights were totally a pain in the butt for me And I would get all like sweaty palms. Are they going to send releases for something that I have to update? Because if they do, I've got like 10 sites that are using that module Um So you don't always have to update. However, updating usually isn't very hard either So keeping that in mind, if you've followed best practices doing things like putting all of your code into the site's all Modules directory or sites all themes point releases for Drupal core tend to be really easy Um Make a backup of your site Download the copy of the new code and just replace all of the existing code with what you downloaded and run the update dot php script and Probably 99.9 of the time everything works and you're done and that's it Um And so while you don't necessarily need to do them all right away It's also important to remember that for the most part, they're not very difficult You need to test it though. Um, you can't just Upload this code to your production site being like hey the Drupal community said this Version of Drupal is going to be stable and work and it fixes all these problems. I'm going to upload it and put it on my site and oops Um, again local testing is very important with all of this stuff talking about updates, um When I first started building Drupal sites I learned about the ability to use the multi site system Which was basically allowed you to create a bunch of sites that ran off of a single Drupal code base By doing some fancy stuff with directory names inside of the sites directory You can run a whole bunch of sites off a single Drupal code base Which is awesome because now I've only got one code base to maintain And on wednesdays when a new version of Drupal came out All I had to do was update the code in that one spot and bam all of my sites were updated And it was really really powerful um and I used it a ton And built more and more sites and for me it was like I've got one code base I'll just keep using it over and over for all of these sites And I kept adding more modules to the code base as different sites came along And I would need you know some modules for one and not for the other eventually I probably had like 20 plus sites running off of a single Drupal 5 code base. Um, and then there was an update to um views at the time That was I believe it was a security update I don't remember for sure, but there's an update that came out And I needed to update views. However, I had another module that I was using I'm probably like five or six of the sites that was totally broken by this update to views Uh, but I didn't find out until like five weeks after I had updated because I just was like, oh, this is great Um, I'll just install the new code and all of my sites will be up to date and secure and it's great Um, and it turns out like five of these sites were sitting over there and half the pages on them Didn't work and you couldn't get to it because there was some Issue with another module that was relying on code that was in a prior version of views that no longer existed And that site was broken and I didn't really know I kind of had this false sense of security that like hey They're all running off the same code base. I'll check the big ones if they're still working I can assume all the little ones are still working to apparently not really And this got me to sort of this place where I understood that Running all of my code or all of my sites off the same code base Um, has some underlying challenges to it and updating is one of those the implication here is that if you have a single code base Um, updating a module is updating all of those sites But that's not necessarily always what you want to do and there are ways around it There's ways to say like make this site in the multi site install use this copy of views But everything else use this one and I did that for a while But then I got away from this being organized all of a sudden I had a Code base that had four different copies of views in it Um, and it became even harder and harder to maintain So multi site is awesome and it was really powerful But before you make the decision to use it, it's important to understand how the system works and sort of what The box that you're going to be putting yourself into if you're building a whole bunch of sites for like say a Departments in a university where like every single one of the sites is Exactly the same except for they maybe have a different theme then yes multi site is a great tool for that um, if you're doing what I did which was trying to figure out shortcuts to not have to Update views on 20 different sites when there was a security release Multi site is probably not the right answer for you because you're going to end up sort of in that whole same place That I did which is some sites are ready to upgrade when others aren't This becomes even more challenging when it's time for a core version upgrade or a major version upgrade So going from Drupal 6 to Drupal 7 This implies that I'm prepared to update every single one of my sites at the exact same time versus one at a time Which isn't necessarily true um Testing is really important And and testing that the page on all of the sites works not just on the three big ones is also really important As I learned so I I had that mistake where some of my sites would fail Kind of unknown to me until the client sent me an email being like, oh, how come this doesn't work? And I'd be like oh apparently it hasn't been working for like five weeks. Sorry um, so then I became like really strict about testing and I was like I wrote tests for everything And then that sucked a lot of time and later I kind of refined this to be Testing is important But you really only need to test the things that need to work Which in some cases may be everything needs to work all the time for me It tends to be the things that are with this site like if they fail my business model is no longer working This is usually things like if your site collects money Or does anything with money? It's probably a good idea to test that system and make sure it works Because if people can't give you their money, your site isn't doing what it should be doing And you're not going to be able to write any more tests without more money Um, I'd like to test anything that has to do with like user registration and sign up Especially if I've customized it in any way because If that breaks I've essentially Made it impossible for people to join my site or sort of interact with it If some link in the footer of my site for my privacy policy stopped working It's a very unlikely because that page is not very tightly coupled to anything else in the system And b it's not the end of the world if it's not working and somebody ends up having to send me an email Saying hey, that's not working and I have to go solve the problem So does it really make sense for me to spend all the time writing a test for that page? Probably not Does it make sense for me to write a test to make sure that you can log into your account on the site? Yes, it probably does There's a lot of tools for writing tests. Um, I initially Wrote tests primarily using the simple test tool that is built into Drupal core And then later kind of realized that while this was good and allowed me to test a lot of things There were easier ways to test the things that were important to me Um, and I wasn't necessarily trying to do unit testing and make sure that this specific piece of code deep inside of Drupal worked What I really needed to do was make sure that somebody could click on the pay me money now button Um, so tools like selenium or casper, which are just sort of like glorified browsers that allow you to write a script That says hey, I'm a user. I'm going to go through and click on this button Was I able to do all those things? Yes or no Are enough for that kind of testing When you're testing your site, um, when you're first building it when you're installing new modules and testing things anytime you're testing things in Drupal Don't do your testing as user one or that the account that you created when you first installed your site Because user one can do anything all the time in Drupal You want to make sure using a different user other than user one because you want to make sure that all the permissions and security related stuff Is actually working. Um, and so I ran into this a lot of times too where I would like Set up these complex workflows and I tested out as user one and I think it was everything was working fine And then somebody else would tell me yeah, I don't even see that button. I'd be like, I see it. It's right there And they'd be like, no, I swear it's not and they'd send me a screenshot and finally I'd be like, oh And log in as a user with editor permission and I'd be like, yeah, totally your role doesn't have that permission No wonder it's broken And if that doesn't work clear the cache because it's actually probably the cache. That's the problem Um Version control um is actually really really easy This is something that I didn't do for a long time. I was working again by myself My version control system was renamed the file to like No dot module hyphen b a k No dot module hyphen b a k hyphen one Um, and it was just sort of rename all these files eventually I started working with another person and it was just the two of us We still didn't use version control Our version control system was the fact that we sat this far apart from each other And I could say are you editing layout dot css right now? You'd say no, I'm like, okay, don't for a couple minutes because I'm going to make some changes So you'd say yes, I am and they're like, oh, I'm going to send you an email with some changes Can you paste them in there? Um, eventually I was like, I should probably just figure out this version control thing. It turns out. It's really easy It's basically a giant undo button that lets you revert any stupid mistakes that you made Um, it makes it really easy to collaborate with your co-workers You can both work on the same file at the same time without having to be in the same room. It's awesome Um, so take the time to learn version control Version control is only effective if everyone on the project is using it So take the time to learn version control and then take the time to locate all of your co-workers that aren't using version control and smack them Um, if you're going to get into Drupal in any form, I suggest learning a little bit of php You don't need to learn a lot, but the basics of php are pretty simple and it helps You know in Drupal, there's this idea that you know, you could be a designer and just all you have to do is modify css and html And but the truth is our template files still have a lot of php in them And so yes, you can do a lot without knowing php You can do a whole lot more with just a rudimentary understanding of php So take some time to learn that even if your role is like project manager or something Taking time to learn a little bit about how the system works can change Your value in that project considerably Once you've learned php, um stay far away from the php module Um Before I knew about the views module I used to create lists of content on my site by creating a new node and enabling the php filter and writing a bunch of sequel Right into the Body text area and then iterating over the results and printing out an unordered list right on the page And I'd have like my blog page for my site And you can do this with the php module It allows you to basically type php right into a text field and then execute it At runtime for that page. It works great Um, the biggest problem that you're going to see is when it comes time to upgrade something, um, you upgrade some code You go to view a page Nothing's working on the site Your immediate assumption is it must be due to the fact that I updated the views module or whatever module I updated Spend a ton of time trying to figure out Why that module update doesn't work. You finally like try it on another site and you're like, oh, it's flawless It doesn't work. Um, I run into this so many times. I can't count where I can't view a page I can't view a page. I'm getting a php error, but I don't know it doesn't give me a line number or anything Because php run inside of an eval statement doesn't actually give you very good error reporting Um, it really gives you no error reporting Um, and eventually I would debug the problem to be it's a problem with Some php code that was written into the body of this node And the only way to fix it then is like go into the database and edit it directly in the database and for me It was delete that node or whatever so that I could actually get to the site Um, so staying away from php module even though it seems really nice and friendly is actually going to be kind of a pain Once you learn some php, um, you probably have heard this before don't hack core. Um, and The idea being don't modify the code in Drupal core or really, you know Try to avoid modifying the code in Drupal contrib as much as possible Um, this for me was one of those like I stuck to it religiously To the point that I ended up writing this crazy module that I needed to be able to insert a link at the end of every menu That said add another page here But it had to be intelligent enough to know like should it add an article or should it add a You know story or whatever type of node I ended up writing all this crazy code that registered some shutdown functions in php, which was a horrible idea That then like reparse the entire menu system for the page and inserted these in it was like this is great It works, uh, except for it was really really really slow Turns out I made a one line change in menu dot module And then I could just write like five lines of code and do what I needed to and all of a sudden I was like You know what I am totally okay with hacking core if I need to Um, so don't hack core is sort of that like don't You know avoid it if you can but it's not like a religious don't ever do it You will come across occasions where you need to or it makes sense to And feel free to do so when you do document it, uh, and hopefully document it on drupal.org No, I kind of running out of time. I think I'm like out of time. Um, I read the Theme function and this was actually in drupal 5. I printed out a copy of the theme function like on Physical paper and I read it on the bus one day on my commute to work And all of a sudden I understood how drupal's theme system worked way better. Um, it's it's really it's like 50 or 60 lines of code most of it is comments that makes all of the theme system in drupal work It's totally worth just reading the code for this function um Filters affect permissions. So when you configure input filters on your Um site you have the ability to do something like say turn on the php module and give administrators the permission to use the php filter If I create a node that uses a filter that only specific roles have permission to um use Only people that are in that role will be able to edit that Um node and so an example of this is as the administrator user one I go and edit a story that someone else wrote on our blog I changed the filter to be full html to do something they come back They only have the blogger role that doesn't have permission to use the full html filter I've suddenly locked them out of being able to make any changes to that node This is something that bit me a lot early on. Uh, make sure you're running cron Uh cron does all kinds of things in drupal including like Um getting out collecting all the information for the search index Clearing out caches and just sort of doing like garbage collection Um, there's a lot of information in drupal's read me dot txt file about how to make sure that this is running. Um, and just Make sure that it's running Um and then um I talked a bit about testing and stuff. I like to try to automate that as much as possible Um, and I like to now that I've kind of figured out different tools like selenium and so forth Making it so that when I do update a module, I don't have to go and click on every single site By automating things was a really useful thing to figure out Drush makes that possible In a lot of scenarios if you're not familiar with it drush is the drupal shell I avoided this for a long time because I was like, why would I need to use drush? I mean isn't Drupal just like a user interface on top of drush and I like user interfaces It turns out drush is really handy You can just do things like type into your command line download this module and it'll download the module And instead of me having to go and download views and unpack it and put it into the site's all modules directory Drush would just take care of that for me. I can enable modules with drush I can get status information about my site, which as you can tell this one's really old um And most importantly I could clear the cache with drush Um, and this was cool because then I figured out my development environment could call drush as well So I could set it up to do things like whenever I save this file automatically clear the cache So I don't have to think about it anymore um, and then Yeah, I see I told you this is going to be a firehose um one of the things that Happens with drupal and for me was sort of revolutionary and figuring it all out was that I would build all these complicated photo galleries by clicking together a bunch of views and content types and so forth And then it was time to make changes to it because my client needed something different So I'd try it all on my local development environment And I'd write down all the steps on the back of a napkin and then I'd go to my production environment And I'd try to replicate all those steps again The idea of being able to take that configuration and export it into code um Dries talked about this this morning the configuration management initiative but basically the Problem that is trying to be solved is taking this configuration that we've created things like creating a view and put it Into code so that it can go in diversion control and can be easily deployed amongst Your sites or your different environments you can actually do a lot of this now in drupal 7 using the features module uh features basically takes a whole bunch of stuff on your site And it puts it into a meat grinder and you get something that sort of resembles a Feature or a module or sort of resembles meat out the other end And then you can take this code and check it into version control and deploy it between your sites Um, and I'm really out of time so I'm going to skip ahead a couple of slides here to this one So this is important um This for me was like I Drupal's open source. Um, it's licensed under the gpl license open source means a lot of different things To and it means different things to different people when I first got involved with Drupal what it meant for me was Drupal is free So this is awesome. I could download this for free and make a bunch of money building sites later I realized that what it really meant was that I could read drupal Um, and this was like hugely influential and how much I learned about how drupal worked There was always this black box and we sort of get used to building You know you build a site in like share point or something and you never really get to look at the code that powers it So you never have a complete understanding of how the system works Being able to do things like read the theme function Like I cannot tell you how much I learned about drupal from being able to do that and realize like Oh, I had no idea that you could name a template file using this cool Like naming convention and all of a sudden, you know, you're overriding things in a different way until I was able to read the code Um So that's important to know and then there's also because it's open source Um, you can basically like copy and paste the code So find code that somebody else has done most of what you need to do and copy and paste it and modify it to do what you need it to That's a really great learning tool As is contributing to drupal Because it's open source when you modify that code you can contribute it back And when you write 60 lines of code in order to write the word member or members and you upload a patch to drupal.org Um, and then you know quick sketch comes along and says hey, this is great. Thanks so much for contributing this code You could eliminate 20 lines of code from this by using this function At first I'm kind of like oh screw you man. I'd spent so much time figuring this code out and then I was like Wow, I just learned a ton of information for free by the fact that I contributed this back and somebody sort of essentially I got a free code review out of that And learned a bunch about how drupal worked. I learned that there was such a thing as format underscore something functions in drupal I had been doing drupal development for probably four years And I didn't even know that those functions existed until someone told me about it and I only got that because I was contributing back Um, there's lots of opportunities to contribute a good one. Um, this week will be the sprints on friday So if you've never been to a sprint or a drupal con or if you've ever wanted to like get involved and contribute back Um, friday will be a really really good opportunity to do that There's a sort of a sprint setup for people that haven't done this before and are interested in learning about the tools and how to get involved Um attend local user groups Um, I was a drupal developer for years before I started attending the minneapolis user group Turns out there are just a bunch of really cool people that like do things like I do like hang out at bars and drink beer And talk about drupal and they're actually really nice And when I want to know like which module I should use to solve some particular problem One of them has probably done it before and they could tell me which module to use And most important um, and the thing that took me a long time to sort of come to terms with with drupal is that there is no magic There's this idea that like I've downloaded drupal with this black box I can install it and and sort of like oh, I click all these buttons and something magically happens And I was okay with that for a while But once I let myself say there is no magic I need to understand how and why this particular piece works I really took my understanding of drupal and how and all of that to the next level and so that was important for me So that's my presentation lots of information. Um, do you guys have any questions? Yeah, yep. So the question was more uh detail on the difference between a node and an entity Um, which it can be a little bit confusing. Um There essentially a node is a type of entity So if you think of entities in drupal as being sort of a shell that you can use in order to start adding Collections of fields together to create some sort of source of data And then one of those types of data sources that you're creating is a node Um A user is another example of something that's an entity an entity in drupal is anything that can have fields added to it So there's lots of examples of that nodes are a type of entity Users are a type of entity taxonomy terms are a type of entity The idea comes from in drupal 6 with cck we had nodes and you could add fields to a node And everyone is like this is great and really powerful I can add all these fields and then they started trying to turn everything into a node like let's make comments nodes Let's make users nodes. Let's make taxonomy terms nodes. Let's make blocks nodes so that you could put fields on them Uh, because the cck was really powerful is really powerful And so entities takes that concept and basically abstracts it one level further. Um, so now you can have Things or entities that you can put fields onto and then you create bundles of those entities that become like a node type so a You know the page node type is a bundle of fields on an entity It also gives us the ability to have a a more abstract system for dealing with All the data that gets you add a field to a node You add a field to a user the code that runs in the background that performs things like saving that to the database Or removing the value we can have that all be it Encapsulated in the entity system rather than having to rewrite it for each individual system But basically the hierarchy is you've got sort of this concept of entities Which in themselves aren't really that useful like they're really useful for From a developer perspective for writing code It's basically simplifying the ability to do something like create the node system Which uses fields, uh, which exposes things to views and all of that and same with users and so forth Does that help clarify it a little it's a little