The Drupal 8 Rabbit Hole Module allows you to control what happens when someone views an entity page. Before you ask why this might be important, let me clarify, it's not a layout tool. It's a simple module that allows you to easily redirect or prevent users from viewing specific types on entities on your site. If you have content types or other entities that you are using to either build out a view or other area of your site, but don't want users to access the original page for this content type or entity, this is the module for you. If you read this entire description and are still confused, I promise it's very simple. Check out the video to find out how it might be useful for you on a future project.
The Drupal 8 Flex Slider Module allows you to use the Flex Slider library to build out slideshows on your Drupal website. This video covers how to get Flexslider to integrate with Drupal views as well as Drupal fields.
The Drupal 8 Configuration Read-only module allows you to lock down some of your environments to prevent users from making configuration changes. This lets you use the Drupal 8 configuration management system to push up all your changes, while preventing you from changing any settings, content types, views, or any other configuration on your production website.
The Drupal 8 Editor Advanced Link Module allows you to specify additional attributes when creating links in your content. This makes it easy to add a CSS class, an ID, open the link in a new window, or even specify a rel="nofollow" tag. The module is very easy to use, but there is a small trick to getting it set up. Watch the video to see how it's done and start customizing your links in no time!
The Drupal 8 Editor File Upload Module is a great module for allowing your content editors to upload files directly in your website content. If you have ever needed to upload a file, and then include a link to that file, then the Editor File Upload module will be useful. Rather than having to upload the file manually using FTP or through another module, then having to go back to create a link in your content to that file, this module lets you do it all in one step. This saves you (or the other content editors on your site) a lot of time.
The Drupal 8 Image Widget Crop Module is a handy module for allowing your content editors on your website to crop images after they upload them. Have you ever uploaded an image on a website and had it automatically crop the image for you in a way that just looks wrong? This module solves that problem!
In this episode, we cover the Drupal 8 Contact Storage Export Module. This episode covers a module that adds additional functionality to the Contact Storage Module (which we covered in episode 213). This module allows you to export your contact form submissions to a CSV file. It's a simple module that serves a very specific purpose. If you need to export your contact form submissions, this is how you do it!
Check out the Code Karate Patreon page
In this episode, we cover the Drupal 8 Linkit Module. This module extends the link functionality of your Drupal 8 WYSIWYG editor (like CKeditor) to make it easier to link to other pages on your website. Rather than having to go find a page on your website you would like to link to, copy the URL, and paste it in the link field, this module allows you to do it in one step!
Check out the Code Karate Patreon page
In this episode, we cover the Drupal 8 Contact Storage Module. This module extends the Drupal 8 core contact module by saving the contact entries in the database. This makes it easy to go back and view, edit, or delete any of the contact form submissions on your Drupal 8 site. It's a handy little module that can save you from needing to install a more fully featured form module (like Webform or Entity Forms).
Check out the Code Karate Patreon page
In this episode, we will cover five different ways to download and install modules in Drupal 8. Yes, that’s right, FIVE different ways! If you are just getting started with Drupal or are transitioning from Drupal 7 to Drupal 8, this is a great place to start. Once you understand all the ways to download and install modules, you can make the decision on which option works best for you.
Check out the Code Karate Patreon page
Lando is what the cool kids are using for their local development environments these days. In this episode, I give you a quick introduction to Lando and show you how it can be used to create a Drupal 8 site in less than a minute. I also show you how you can integrate Lando into your workflow if you are hosting your websites on Pantheon.
Are you using or have you tried using Lando yet? What are your thoughts?
Check out the Code Karate Patreon page
I know it's been awhile since I last posted, but I think we are all ready for some Drupal 8 videos! Let me know in the comments what you want to see posted in the future.
Check out the Code Karate Patreon page
Have you ever wanted to create a page on your Drupal 7 website and send it over to a friend or group of people… but you don’t want the general public to see it? You could always set it up so they just log in, but that’s an extra step and not all of the people you want to send this to have user accounts on your site.
If this sounds like you then the Token Content Access Module is just what you need. The Token Content Access Module makes it easy to hide a page and require a unique key to be added to the URL to gain access. This means you can create content, hide it from those pesky anonymous users, and drop that hidden link directly into an email campaign to ensure only subscribers will see the page.
Configuration on this module is simple. Just turn the module on, edit the content type settings, and finally edit the page. That’s really all there is to it.
If you are just getting started with Drupal and are looking for some help on learning Drupal 7. You have come to the right place.
In this simple Drupal tutorial, I will highlight some resources for getting started, provide you some Drupal basics, and then if you are interested, you can sign up for Code Karate's 30 Day Drupal Email series (using the form at the bottom of this post). The email series breaks the entire Drupal 7 learning process into manageable chunks spread out over 30 days. In fact, the Drupal tutorial below is just a simplified version of what you will get in your inbox.
Drupal introduction
First, you might be wondering... "what is Drupal and why should I use it?"
Well, in it's simplest terms, Drupal is an open source content management system (CMS) that can be used to build all different types of websites from simple to very complex. Drupal allows you to create a website and manage all your content, media (images & video), users, and so much more. Drupal is much more than this, but hopefully that gets you pointed in the right direction. Drupal will help you build awesome and extremely flexible websites... that's the best simple definition I can think of.
Now you are ready to learn about some available Drupal learning resources. The link below will take you to a link that discusses some of the various ways to learn Drupal.
Best Way to Learn Drupal
If you are ready to get started right now. Read the following two sections to learn how to get Drupal installed and how to start managing your content in Drupal. If you get stuck or need additional help, don't hesitate to contact me.
Installing Drupal
Objectives:
Learn about the different methods for installing a Drupal 7 website
Learn how to get a Drupal website installed
There are many different ways to install Drupal. These different ways depend on how you want to develop your site and what type of computer you are using. The first question you need to ask yourself is if you want to develop your Drupal website locally (directly on your computer) or if you want to use a third-party service for developing your Drupal site. You will learn about each of these different options.
Installing Locally
The most common way to get started is to install your first Drupal 7 website directly on your computer. In order to do that, you will need to install some programs to get your own personal web server set up. The setup varies depending on what type of operating system you are using. In the following sections, you will find resources for getting Drupal installed locally for a variety of different operating system.
Installing on Linux
You might wonder why Linux is the first on this list. Well.. perhaps I am a little biased. Either way, below you will find a link that will walk you through how to get a local development environment set up on an Ubuntu Linux operating system. Other flavors of Linux are similar, but may vary a little.
If you are running Windows or Mac and want a more streamlined option, I would recommend using Acquia Dev Desktop. It provides a simple and seamless experience.
Macs are also popular options for developing with Drupal. If you have ever attended a DrupalCon, Drupal Camp, or other Drupal-related event, you will undoubtedly have seen an abundance of Apple logos in every session. Installing Drupal on a Mac is pretty straightforward, just follow the videos below to get your own MAMP server set up. MAMP stands for Mac (the operating system), Apache (the web server), MySQL (the database), and PHP (the programming language).
Vagrant is a tool that allows you to build an easy to reproduce development environment. This means you will have a consistent development environment that you can rebuild, reconfigure, and essentially destroy as needed. It’s a tool that I along with many other seasoned Drupal developers use. If you are just getting started with Drupal, and you are not a well versed server administrator, you might want to come back to this later. If you do want to check it out, the link below can start pointing you in the right direction.
There are other third party platforms you can use to develop your Drupal website. Some of these are built directly for developing Drupal websites, and others are built to support a variety of other platforms, but still allow you to develop a Drupal site.
Here are some services that provide development environments specifically tuned for Drupal. Feel free to sign up to either of these for free to try them out. They have pretty straight forward documentation on how to create your first Drupal site.
Here are some more general Drupal hosting services that CAN serve as a development environment. I would recommend using the other above options if possible to develop your Drupal site, and keep the options below for when you are ready to launch your site live.
As you can see there are many options to install Drupal. Unfortunately there is no one right way. It all depends on what you are looking for. If you are in a bind and don’t know what to do, I would suggest trying Acquia Dev Desktop first, and going from there.
Managing Content
Objectives:
Learn how to add, edit, and delete content on your Drupal site
Learn how to use the content administration page
First, look through the following two articles from Drupal.org:
Now, complete the following steps on your own to try out what you just learned:
Create your first few pieces of content on your Drupal site. These could be pages or articles but make sure you have at least one article.
Make sure you can find, filter, and edit the content from the Content Administration page
View your homepage to see a list of articles you have created. Notice that if you click on the title of the article you get to the full node page. From this page, you will see tabs at the top for viewing and editing the individual node.
Content Management Summary
You have now learned how to add, edit and delete content from your site. Make sure to spend some time trying out the available configuration options when creating content to get a feel for what they all do.
Getting Started with Drupal Summary
You now know how to install Drupal and how to manage content inside of Drupal, but you still have a lot to learn. These first few steps are only the beginning. If you want to continue learning more about Drupal, you can enter your email below to receive an email a day teaching you more about Drupal for the next 30 days. If you want to continue learning right now and don't want to wait 30 days, take a look at Code Karate's Learn Drupal in 30 days eBook.
Good luck on your Drupal journey!
Drush... what a wonderful web you weave. My guess is you have probably heard about this mysterious thing known as "Drush" and are looking to find out:
What exactly is Drush?
Is Drush something that will be useful for me?
The first one is an easy one. Drush is short for Drupal Shell and is a command line tool that makes interacting with your Drupal website a breeze.
The second question is also easy, but first I have a question for you. Do you use Drupal? If the answer is yes... then Drush will probably be useful for you.
Drush: An Introduction
You might be thinking to yourself about now... "but I don't spend hours of my day behind a command prompt". In fact, you might be a little nervous about even having to open a command line window. Don't worry... we will try to take it slow.
I'm convinced that if you do even a modest amount of Drupal development, spending just one hour learning how to use the command line and Drush commands will save you countless hours of time. In the next few sections, I am going to show you how Drush can be used to automate and simplify a lot of common Drupal administrative tasks.
Getting used to the command line
If the command line scares you... don't worry, you are not alone. At one point many years ago I was thinking the same thing... "why can't there just be a nice GUI for this?" If you spend a little time learning though, you will quickly find out that it's not as bad as it seems and it can save you a lot of time.
If you are not familiar at all with the command line, below you will find a quick tutorial that will help you get started. If you are already familiar with using the command line, you can skip this section.
Special Note for Windows Users: Sometimes it's tough to be a Windows developer... This is also true if you want the best experience using Drush. You "technically" don't need to install any additional programs to get started, but I would recommend installing Msysgit and getting it to work with Drush. This tool will provide a much better and more powerful command line experience. Msysgit will allow you to use a Bash shell (just like your Linux and Mac friends).
Opening up the terminal
It's now time to open up the terminal. If you are using Windows, open up your shiny new Msysgit program. If you are using Mac OSX, open up your Finder, select Applications, then Utilities, and find Terminal.
Oh... If you are using a flavor of Linux (like I am as I write this)... wait who am I kidding. You already know how to use the Terminal... go ahead and skip this section!
Some basic commands
Don't be intimidated by the contents of the terminal window (or the lack thereof). Simply get started by typing in a simple command. Go ahead and type:
ls
Then hit Enter.
You should now see a list of the files in the current directory. This is no different than browsing your files on your file system. Now try:
pwd
This command stands for "print working directory" and will print out in the terminal your current location. The next step is navigating, you can do this using the cd command. Go ahead and run the following command:
cd ..
This tells your terminal to "change directory". The .. tells the terminal to go up one folder. You can use the pwd command to see your current location.
If you want to go back into the folder you just navigated out of, try this:
cd [folder-name]
Replace [folder-name] with the name of the folder you want to navigate into. Note: Once you start typing the folder name, you can hit tab to auto-complete the name for you. You will use the tab key often when you are using the Terminal to save you time.
Those are the basics, but there is a lot more to learn. Here are some other commands you might want to try out.
CommandWhat it does
cdThis command on its own will return you to your home folder (where you started when you opened up the Terminal)
touch [file-name]Create a new empty file called [file-name]. Example: touch test.txt
mkdir [folder-name]Create a new folder. Example: mkdir myfolder
cp [file-name] [new-file]Create a copy of [file-name] and call it [new-file]. Example: cp test.txt backup.txt
mv [file] [new-location]Moves a file to a new location. Example: mv backup.txt ../ This will move backup.txt up one folder level.
rm [file-name]Deletes the file [file-name]. Example: rm test.txt
Drush: Getting things Installed
The first step is to get Drush installed. Installing Drush is not an overly complicated process, but because it varies depending on the operating system your website runs on, and if you are running the site locally or on a remote server, I won’t go through all of the installation possibilities here.
There is a page on Drupal.org that provides information depending on the type of platform you are installing Drush on. Typically you need to install Drush on the server that is hosting your Drupal website (you can get around this with something called Drush aliases, however, we won’t be covering that topic). For the installation instructions, go to https://drupal.org/node/1791676.
Drush: Downloading and Installing Modules
We are now ready to begin installing some Drupal modules and themes on our new Drupal website. I am going to start with one simple example. Downloading and installing the module_filter module.
Drush CommandWhat does it do?
drush dl [project-name]Downloads a Drupal module or theme. The name can be grabbed from the drupal.org project name. For example in https://drupal.org/project/module_filter the project name is module_filter
drush en [module-name]Installs a Drupal module. Keep in mind when you download a Drupal module, it may contain multiple modules. You can get the correct module name from the output of the drush dl command.
The first step is to download the module_filter module using the drush dl command:
This command will tell you where the module was downloaded (in this case sites/all/modules/module_filter) and if there are multiple modules that can be enabled/installed.
Now we install/enable the module using the drush en command.
You can also use the drush en command to download and enable multiple modules at a time. Just put a space between each module name when running the command.
Drush: Disabling and uninstalling Modules
There may come a time where you need to disable a Drupal module. If this is the case, you can do so with the drush dis command. You can then uninstall a disabled module with the drush pm-uninstall command.
Drush CommandWhat does it do?
drush dis [module-name]Disables a Drupal module.
drush pm-uninstall [module-name]Uninstalls a Drupal module.
If you were launching your website and you no longer needed the views_ui module, you can disable the module using drush dis views_ui.
A Drupal module can be disabled, but that does not necessarily mean it is uninstalled. A Drupal module may create additional database tables in your Drupal database or add additional variables to your Drupal variables database table. If you disable the module, those database tables and variables will not be deleted. This means you are able to enable the module later without losing any of your module settings.
The drush pm-uninstall command will completely uninstall your module removing any database tables and variables that the module has stored.
Here we run the drush pm-uninstall views_ui command to uninstall the Views UI module that we previously disabled.
Drush: Running cron and clearing cache
Now you will learn how to use drush to run cron and clear the cache on your Drupal site.
Drush CommandWhat does it do?
drush cronRuns Drupal cron process.
drush ccClear the Drupal cache.
drush cc allClear all of the available Drupal caches.
You can manually run the Drupal cron process using Drush by running the drush cron command.
You can clear the Drupal cache using the drush cc command. After running this command, Drush will provide you an option to select which cache you want to clear. In this example we select 1 to clear all of the available Drupal caches.
You can also specify which Drupal cache to clear directly in the drush cc command. In this example we run drush cc all too clear all of the Drupal caches without the extra prompt to choose the Drupal cache to clear.
Additional Drush Commands
Here are some additional Drush commands you might want to try out:
Drush CommandWhat does it do?
drush archive-backupBacks up the code, files, and database of a Drupal website.
drush archive-restore [backup-path]Restores a Drupal website to a previously backed up state.
drush upUpdates the modules, themes, and core Drupal code on your Drupal website. This command will also perform any necessary database updates.
Drush Wrap-up
There is a lot more you can do with Drush. You can always get a list of commands by running drush help. You can also use the helpful website drushcommands.com. If you want a helpful Drush cheatsheet, enter your email in the box at the bottom of this page and I will send you mine! I will also send you some additional Drush commands and getting started ideas.
Are you testing your site? Until recently, we weren’t and it was costing us. Every element on your website should have a meaning and if you aren’t testing it against something else how can you be sure that you are maximizing your results!
Welcome, Optimizely. Optimizely is an A/B testing tool that allows you to modify the HTML and CSS of your website to test different website elements. The configuration for this service is limitless. After you configure an Optimizely experiment you then get to look at the results and determine how each element worked best on your site. Remember, knowledge is power and Optimizely sure give you a lot of knowledge.
How does this relate to Drupal? Well, if you use the Optimizely Drupal module you are able to specify which pages you want the Optimizely Javascript to load on. By default, optimizely will load the Javascript file on every page. The problem with that is your experiment most likely is only on one page. Loading a Javascript file on pages without an experiment running is wasteful and slows down page load time.
What if you had to go build a Drupal site on a remote island without WiFI? Yes that's right, no internet connection at all? What modules would you bring with you?
For some random reason, I posed this question to myself and came up with these 4 modules. Because I believe these modules can be used to build a multitude of complex Drupal sites, I think of these modules as the "Ultimate Site Builders Toolkit". Become an expert in these modules and you will be able to build some wicked awesome and complex Drupal 7 sites.
Module #1: Views
The Views module was, of course, my first choice. How can it not be? I use this module in every Drupal 7 website I build. Most people know that the Views module is great for creating lists of content. However, not everyone knows the intricacies and complexities of views. Once you start learning about relationships, contextual filters, and aggregation, it opens up a whole new world of possibilities.
If you are going to build a complex Drupal website on a remote island... you are going to want to take Views with you.
Module #2: Panels
This one will be the most controversial. After all, everyone has their site building layout tool of choice. For some, it might be Display Suite, Context, or some other Drupal module... but for me, it's Panels hands down, without a doubt. I know it can be a little heavy-handed at times, but it's packed with a plethora of features that make any site builders worst layout nightmare a breeze.
If you are just getting started with Panels it can seem a little intimidating at first. There are so many things you can do with the module. Once you master the basics and start understanding contexts, relationships, variants, and visibility rules, the options really start to open up. If you know what these are and how they are used, you can master almost any layout with ease.
I am packing the Panels module in my suitcase when I head for that remote island. Quick question... does this remote island have a nice beach? I sure hope so...
Module #3: Rules
When you say to yourself, "when this happens, then I want to do this" that is usually a solid foundation for a rule. Rules can do so much that sometimes the true test is to learn when to not use them. I can't tell you how many developers have contacted me asking me to help them get the rules module to do something that could easily be accomplished with views, panels, and entity references.
If you do master Drupal rules, you can accomplish some pretty awesome things.
Remote island... Check. Rules module... Check. What to do when my laptop battery runs out.... Unknown.
Module #4: Entity Reference
Used correctly, the entity reference module allows you to build complex and interconnected data structures. This one module helps turn Drupal into a content and data modeling tool. You might be wondering what is so great about relating content with entity reference? Well, content doesn't live on an island (even though I am on one in this figurative thought exercise). This means content is connected to other entities (nodes, users, etc) on your site in sometimes complex ways. The Entity Reference module makes this possible.
The Ultimate Site Builders Toolkit Summary
Arming yourself with great working knowledge of these modules will make you absolutely lethal when it comes to completing complex website requirements. Did I mention you can do this without having to write a single line of PHP code?
How do you rate yourself on knowledge with these modules? If you want to become a better Drupal site builder (without having to write code), then leveling up your skills with these modules is one of the best ways to spend your time.
It's your turn to take the #IslandOfDrupal Test
So now I pose the question to you, if you had to go build a Drupal site on a remote island without WiFI, what modules would you take with you?
Go ahead and take the #IslandOfDrupal test yourself and post your answer in the comments below (and try to keep the number of modules below 5)... This should be interesting!
Also, please share this post with others in the Drupal world.
Awhile back I posted a video on setting up a Drupal sub-theme. If you want, you can check out that video here. I think that the video does an alright job of explaining the steps you have to take to get a sub-theme to work properly. I don't however think it provides enough of the setting up a sub-theme "meat" needed to begin. The saying goes, the devil is in the details. Personally, I never liked that quote, but it is fitting here. Anyway, if you're looking to get a full in-depth guide to setting up a Drupal sub-theme, you, my friend, just need to keep scrolling.
Let's begin.
What is a sub-theme anyway?
This seems like the appropriate place to start. Drupal has two types of themes; you have a base theme and a sub-theme. A base theme (Zen for example) provides basic theme design and functionality. The work has already been done for you. Cha-ching! A sub-theme provides all the unique design and functionality. A sub-theme where you get to build the exact website of your dreams.
If you're still confused, try thinking of it this way. Let's assume a base theme is the basic vanilla ice cream cone. A plain vanilla cone is still a cone. You could eat it up and leave happy, but what if you wanted to add some strawberry syrup? Adding the strawberry syrup is like adding the custom design to your site. So instead of having to create the entire cone (remember the vanilla was already provided) you just have to add the strawberry syrup or whatever you want to build the ice cream cone you desire. Drupal base themes and sub-themes work exactly like this. Using a base theme will provide you a lot of the design and functionality you need and then you can use a sub-theme to design the site exactly how you see fit.
Are all base themes created equal?
This is kind of a hot topic with designers in the Drupal community. In my opinion, the answer is nope. Every designer has their personal preferences to which base theme to use. Some of the most popular base themes are Zen, Omega, Fusion, and Basic. Personally, I use Zen. Any theme can be made into a sub-theme. This makes choosing a base theme endless. If you're just getting started with designing in Drupal, it is best to spend some time working with a variety of theme to find which theme works best for your coding style. Here a few reasons why Zen works for me.
Widely supported and used (over 1.5 million downloads)
Responsive out of the box
Supports SASS
Follows a concise file structure
Easily customizable
Downloading and enabling Zen
Let's start with getting Drupal Zen installed. You will want to go here and download the newest recommended release of Zen. To download, simply click on the either the .zip folder or .tar.gz folder. Once the download is complete go ahead and extract (unzip) the folder.
Note: I'm assuming you're using Drupal 7. If you're using a different version of Drupal things aren't going to work exactly the same.
Next, we need to move the folder onto our site. If you don't currently have a site setup, you can follow along with this video on setting up a site using Blue Host. If you have a site created already use your FTP client and move the folder into the sites/all/themes folder.
You want to place your base theme here as this is the folder that Drupal will look for your sites themes. If you want, you can download other base themes and move them inside the sites/all/themes folder. That's it, well at least for the Drupal base theme.
I'll add a little sub-theme to my base theme, please
This is where things start to get exciting. By exciting, I mean that in the nerdiest of ways. With the base theme installed, go ahead and navigate to the folder labeled Zen. Within the Zen folder, you will see a folder labeled STARTERKIT. This folder is our sub-theme. One thing of note, Zen provides you a sub-theme some of base themes will not. This is just another reason Zen is a great option!
Which the STARTERKIT folder selected go ahead and cut and paste the folder within the themes folder. Yep, this is the same place you put the Zen base theme. So when you are done, you should have two folders under the themes folder, one for Zen, and one for STARTERKIT. It is super important that these both are on the same level. If they aren't on the same level, then Zen won't know how to reference the sub-theme you will create.
Getting into the sub-theme details
Things are progressing nicely. We now have our base theme and sub-themes installed and in the right locations. Now we are going to look at configuring the sub-theme.
The first thing I like to do is rename the STARTERKIT folder to something a little more meaningful. You can name the folder however you want, but a few things to keep in mind is to avoid spaces and use a name that represents the site your building. For example, I like to use the company name the site is for.
There are few files that will need some attention. The first file you want to look at is the STARTERKIT.info.txt file. An info file is a static file for defining and configuring a theme. Before we edit the contents of the file go ahead and rename the file. For consistency sake, I always name the info file the same name as my sub-theme. So if I named my sub-theme codekarate, my info file would be named codekarate.info. You can go ahead and get rid of the .txt extension also.
There is more in the .info file then I am going to cover in this post. If you would like more information about the .info file, just make sure to let me know in the comments below.
Within the .info file go ahead and change the name and the description to something that fits your sub-theme. For the description, it's could practice to include information as to what base theme this sub-theme is using. So for example you description might look like this: "A custom theme for [store], based off of Zen.". Take this for what it's worth, it's 100% preference. For now, that is all you need to change within the .info file.
Still within the sub-theme, open up the theme-settings.php and template.php files. Within both of these files, you want to change EVERY instance of STARTERKIT to your theme name. For my example, I would replace STARTERKIT with codekarate. It's important that this matches EXACTLY to your theme name. A little hack is if you use the find and replace feature you can pretty quickly replace all of those instances.
Customizing the look with templates
We've spent a lot of words to get to this point. Thankfully, you're so close to the finish line. Before you click off and start building, I want to show you one more thing.
Zen works off of templates. These templates use HTML and PHP to control how the content is displayed on the site. There are templates for a variety of different sections of your site. Each of these templates controls the HTML structure and what pieces of content get displayed. They are super powerful. Here's the but. Since you are building your own custom sub-theme you don't want to just rely on the templates provided by the Zen base theme. You want the control, now let's take that control.
Within the Zen folder, locate a folder called templates. Inside of this folder are all the templates that control the layout of your site. Go ahead and copy the html.tpl.php and page.tpl.php files and paste them within your sub-themes template folder.
To modify ANY template you HAVE TO HAVE the html.tpl.php file within your sub-themes template folder. If you don't, no changes will take effect. Also, by default if you don't copy a template from the base theme to your sub-theme Drupal will remain using the template in the base theme.
Don't mess with Zen
So you might be thinking why would I mess around with creating all this sub-theme stuff when Zen provides me everything I already need. The answer resides in Drupal being an open source technology. Since Zen was built and continues to be enhanced by a group of individuals, there will ultimately be improvements/updates that you will want. If you start to "hack" the Zen base theme, then you import those new updates all of your changes will be erased. Not good. Just save yourself the headache and late nights and avoid modifying any base theme.
Wrap it up already
Hopefully, now you have strong understanding of what it takes to set up a sub-theme. There are a few steps that need to be taken, but like anything if you do it a few times it becomes second nature. As Micheal Jordan famously said, "You miss 100% of the shots you don't take." Take the shot and create something beautiful.
Do you use a different base theme? Which one, why, what's different? Let me know in the comments below.
Happy Coding.
Normally, I would do this video style, but I'm a wildcard people and today we write! Thanks to one of our Code Karate supporters, Pieter, I am going to walk you through how to use Drupal views, date and content types to automatically hide/show nodes based on date field. Let's get started.
Make sure that you have Drupal Views installed. If you're new to Drupal, Views is like oxygen to humans, you REALLY need it. Also, you can learn more about Views by watching this Drupal views video. Also, I installed the Drupal Date module. I will use this module to set the date for the node (explained more below). Besides Views and Date, you shouldn't need any other modules besides what already comes with Drupal core.
For my example, I am going to display a list of training times people could sign up for and then once the training session has passed the view will no longer show that training. Make sense? Let's build!
A quick note before we get ahead of ourselves. When you enable the Date module, make sure that you enable Date, Date API, Date Popup, and Date Views. These additional modules will make your life a little easier. You're welcome.
I think we're ready. To start, I am going to create a training content type. For the fields, I am just going to keep the defaults Title and Body and add additional field training date. Naturally, you can add other fields that fit your unique situation, but for the purpose of this example we won't need any other fields.
With that content type, I am going to create five different nodes. Each of these nodes will have a different date. For the sake of showing how to hide content based on date, I am going to make one of the nodes have a date in past. This node will be used to prove that my view is only showing training dates in the future.
With the nodes created, we now need to create a view. Before we start excluding dates from showing in the view, let's make sure we get a view that displays all the content we want. To do this, make sure you add all the fields you want for the training content type. For me, that means I have added the Title, Body, and Training Date fields. Also, under the Filter Criteria section I have limited it to only showing training content types. Doing this will show that I can display all the training content.
Next, we need to add a filter that will only show the training dates that are in the future and exclude those that have already happened. Remember, in my example I have added a date in past for my 1st training node. If the view is built correctly it shouldn't exclude the 1st training node, but still show the remaining four training nodes.
The first step to do this is to add a filter to your view. For the field, you will want to select the Training Date field (or whatever field you are using for the date). For the settings, keep everything default except for the granularity. I change this to be minute. The reason for this is because I want the training to be available to be seen right up until they start. If I kept the granularity at a day, it would be hidden at the beginning of the day.
The filter criteria are where we do the filtering for the view. In other words, this is what is telling the view to show or not show. Again, the goal is to hide old training once the date and time have passed. To do this, select the Is greater than operator and change the drop down to Enter a relative date. Within the relative date text field, enter "now". Why now? Now is a PHP date format that specifies the current date and time. So "now" is an always changing value, which is exactly what we want. There are tons of other PHP date strings that you can use if "now" isn't exactly what you are looking for. To learn more about those formats just go here.
That is it! Once you save your filter go ahead and take a look at the view. Again, if done correctly, we shouldn't see the 1st training node as that contains a date field less than "now".
Hopefully, you were able to follow along and get your view and content displaying correctly. Remember, you can use other PHP date formats to show/hide content based on your unique situation. There are an almost unlimited amount of possibilities.
This was a very simple way to filter content. Do you use a different way? If so, share it in the comments below.
Until next time, Happy Coding!
Taking a content type and displaying it in a Drupal View is core to any Drupal website. If you are new to views, you can check out our Drupal views video. As you venture into views you will learn hundreds of ways to manipulate content to change the way the end user is able to interact with the content. To help enhance this, you can use the Views Isotope module. This module uses the jQuery isotope library to dynamically filter views content. As the title states, it’s pretty fancy.
To get an idea of what the library does visit the website for the library at http://isotope.metafizzy.co.
Links:
jQuery Views Isotope Module: https://www.drupal.org/project/views_isotope
jQuery Views Isotope Library: http://isotope.metafizzy.co/
As a request from David over at luxor.me, we checked out the Mmenu module. This little gem allows you to use various javascript libraries to create a mobile friendly navigation. The navigation it produces is similar to the slide in menus you find side a lot of mobile applications.
Setting up this module isn’t the easiest thing in the world of installations. To get the module fully functioning you need to install the Drupal module plus 4 separate javascript libraries. The libraries and the links to those libraries are included below. Also, if you check out the module page you will see the creator added some basic documentation as well. This is worth checking out.
Word of caution, when you install the jquery.menu library make sure to use version 4.7.5 and NOT the latest 5.0 version. Not entirely sure why the new version doesn’t work, but trust me it doesn’t. Use 4.7.5 and you will avoid an unnecessary headache.
Links:
Mobile Sliding Menu: https://www.drupal.org/project/mmenu
Mmenu Installation Guide: https://www.drupal.org/node/2324017
Jquery.Mmenu (Use Version 4.7.5):https://github.com/BeSite/jQuery.mmenu/releases
hammer.js: https://github.com/hammerjs/hammer.js
jquery.hammer.js: https://github.com/hammerjs/jquery.hammer.js
Icomoon: https://www.drupal.org/files/mmenu-icomoon.tar_.gz
JQuery Update - https://www.drupal.org/project/jquery_update
Mmenu - http://mmenu.frebsite.nl/
Sometimes you have a situations where your normal Drupal administration menu just won’t cut it. Maybe you have someone that needs to perform some administrative tasks on your site such as managing content and comments, or perhaps something more complex such as managing the Drupal blocks. This person might be a technical wizard, but there is also a good chance that they might not be. In fact, they might be the person in the office that calls you when their “computer is broke”.
If this is the case, then the Administration Menu Source module might be your saving grace. This module works with the Admin Menu module to allow you to specific different menus for the different user roles of your website. This makes it really easy to fine tune the usability of your site’s administration navigation to cater to specific types of users.
If you have multiple types of administrative roles that perform admin or managerial tasks on your Drupal site, go ahead and give this module a try. It’s easy to set up and will make things a little easier to find for everybody involved.
Note: Make sure to give the correct roles the "Access administration menu" permission so they can view the admin menu.
In this episode of the Daily Dose of Drupal, we looking at the ToDo Filter Module. As I mention in the video this is one of those modules that probably isn’t going to wow you and honestly won’t be used a lot. However, this module does have its place in your Drupal module repertoire.
As demonstrated in this video the ToDo Filter module allows you to add checkboxes into any body or long text field. It is important to note that this isn’t a separate field type. I know, it should be. Once you enable this module within one of your site’s input filters you just have to make sure to set the processing order of the To Do Filter to last. If you don’t your other input filters will override the custom syntax used by the module. To see this all in action, make sure to check out the video.
Off the top of my head I think this module can be used if you need to track a support checklist or the obvious to do list. One neat feature that this module uses is the node_save function. By using this function you are able to check or uncheck a box and this automatically saves the node. Using this function eliminates the task of having to make changes to the node via the edit page.
Overall, this is a well put together module. It doesn’t do a lot, but what it does it does well. Check it out and let me know what you think.
In this episode we cover an overview of the Drupal 7 Views module. The Drupal Views module is probably the most popular Drupal module and is installed on almost every Drupal 7 website I build. It’s so popular in fact that it’s included in Drupal 8 by default.
The Views module allows you to easily build and format lists of content on your Drupal 7 site. If you need to build a simple list of Nodes, Views can do that. If you need to build a table listing, Views can do that too. In this video, we will go through an introduction and overview of Views, as well as a few example views. You will learn about the different types of content you can display with Views, different display settings, and other Views options.
This video is built to be an introduction for beginners and newcomers to Drupal to teach the basics of the Drupal 7 Views module. In this video you will create two views. The first will be a page view that displays a list of articles on your Drupal website. The second will be a block view that shows the titles of the last three articles on your Drupal website. Using the skills you learn in this video, you will be ready to tackle more complicated problems that can be solved with views.
Now go out and build yourself some views!