In this lesson we cover the Insert Module along with FileField Sources Module. The Insert Module is a great module when combined with a few others and is setup right. It takes a few configurations but gives you lots of flexibility with your images and placing them into the text area. We also demonstrate how you can use the FileField Sources module to make the insert module that much better when it comes to media management.
Note: not all Drupal modules provide access to images that are uploaded using a different toolkit. Before committing to a specific suite of media management modules, you should create a test site and practice uploading images. Based on your tests you will be able to better evaluate if you have chosen the right tools for your content managers.
Additional resources
This video goes through the process of creating a configuration form in order to save settings to the variables table in the database, and how to integrate those variables into your module.
Correction
The $item
array in the function demo_menu()
should be named $items
, to match the return $items;
line. (Either that or return $items;
should be fixed to return $item;
.) Just make sure the array you are building matches the name of the variable you are returning.
Additional resources
This video walks through the handy devel module from http://drupal.org/project/devel and demonstrates the tools it provides for debugging, inspecting and analyzing the code and SQL queries happening on your site. In this video you'll also learn about some of the helper functions built into the devel module that make it simpler to inspect the large nested arrays that you'll commonly come across when writing code for Drupal.
You may not have heard of the function dsm() before now. It is a legacy function and dpm() is the newer name. The two functions are identical since dsm() is just a wrapper for dpm().
The idea is that dsm() was a poor name for the function, it's short for drupal set message, but what was later decided that drupal print (as in print_r) message was better.
The difference between those two and kpr() is that dpm() does a permissions check to make sure the current user has permission to view devel's output, and then puts the krumo'd variable dump into the message queue via drupal_set_message(). This means that dpm() will work and let you see the output even if you're redirected. Great for debugging forms. kpr() just krumo's and dumps the value right here, right now. No permission check, no regard for where the content is being spit out.
One thing we haven't looked at in our feature yet is Drupal roles and permissions. Here we will create a role associated with out Blog feature and look at how we can roll that important bit in.
In this video we are using the Environment Indicator module to visually distinguish between different environments.
Additional resources
Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)
Features will auto-detect dependencies for you, which can be very handy, but at times it can also be very frustrating when you don't want them to. In this video we introduce the Features Plumber module and show you how to use it to finely control your dependencies.
We are sometimes asked how Features can be removed. Since a Feature is just a normal module, you can disable it on your module administration page, and even uninstall and completely remove it from your modules folder. That will completely remove the feature from your site.
Note: The Features plumber module is no longer necessary if you're using Features with Drupal 7. The functionality provided by this module has been included into newer versions of the Features module. So as long as your Features module is up-to-date you should be good to go. The concepts from this video do still apply.
Additional resources
Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)
This video describes a number of the most important configuration files within MAMP that are commonly edited in order to run a web application like Drupal locally. There's a brief tour of the http.conf file, and then walks through the process of upping the max_allowed_packet limit from 1M to 2M within the my.cnf, which was a renamed copy of the my-large.cnf file. It's also a good idea to turn off binary logging on your local development by commenting out log-bin and binlog_format lines within this my.cnf file. Addi then shows you how to raise the PHP memory unit from 32M to 256 by opening the php.ini file and changing the memory_limit value. Finally, she shows you how to use MAMP's version of PHP and MySQL from the commandline by editing your .bash_profile and adding a number of paths to your default PATH. Note: The configuration files may have moved between versions of MAMP. You should check for where the MySQL cnf files are for your specific version of MAMP. A quick Google search can probably get you set in the right direction.
To learn how to install MAMP, see the Installing MAMP Server tutorial.
Additional resources
More information on Development Environments
In this video we will be using two contributed modules, not a part of the Drupal Commerce package, called Commerce Shipping and Commerce Flat Rate to set up shipping rates for our products. We set up our base shipping services and then use Rules to modify the final rate as needed. In our example we will be giving free shipping to any order over $100, while we will have a standard shipping rate for orders under $100. We also take a look at how we can use Views to change the line items displayed on our orders.
If you need a refresher on the Views or Rules modules, you can watch these other Drupalize.Me series:
Note: as of Commerce 1.4, you should be using the "Price comparison" condition instead.
Walks through the process of first adding the search block to the node template file, and then explains some of the best practices for incorporating JavaScript scripts within your theme. Walks through how to protect the dollar-sign variable, and how to use the Drupal behaviors instead of the document ready so that your JavaScript will fire not only on page loads, but also if there is any dynamic material being loaded on the page through asynchronous page loads. We'll show you how to select the jQuery selector to target the desired element, and how to conform to Drupal's best-practice coding standards when it comes to integrating JavaScript and jQuery into your theme. You can learn more about jQuery itself with the Introduction to jQuery Series.
To use Query in no conflict mode, because was not defined.
Add this line on the top: jQuery.noConflict(); more info here: http://api.jquery.com/jQuery.noConflict/
To improve how the search box looks, you need to modify the following:
currently : search-theme-form
modify to: search-block-form
and then in the property in line 321 to look like this:
/* Header quick search */
#header form#search-block-form {
top: -165px;
Additional resources
In this lesson Karen will talk about how to use Panels and Panelizer to display group content in various ways. She will first demonstrate how to use the built-in features that come with Organic Groups to construct a basic group and group panel. She explains how this can be done using the features module. She then demonstrates using the new Panelizer module to create a system where every group can have its own layout and content. Note: Karen enabled the Features module then separately enabled the OG Example feature, which has a dependency on Panels and other modules so basically Features enabled them. If you actually enable that feature on the modules page it will tell you that panels is required and asks to install it. Karen however enabled the Panels modules via the Features admin page.
Additional resources
Shows how you can use the ajax framework in Drupal 7 to load additional content onto the page dynamically after clicking on a 'read more' link.
The sample code for this series is in the Downloads tab for the first video in this series: http://drupalize.me/videos/introduction-jquery-and-javascript-drupal#do…. If you're skipping around, and things aren't working, you may benefit from going back to the beginning and completing each of the videos in order.
In this lesson, Joe Shindelar goes over all the possible permissions with Organic Groups. He explains the differences between the regular core permissions, and how Organic Groups can override these to give the proper user experience of grouped content. He will show how this affects each role in a group and how to manage those roles.
Note: In Chapter 8 ("Organic Groups Permissions") there are several blocks (Group details, Create content, etc.) and the "groups" tab in the main menu that were not introduced in Chapter 7. These blocks and the new tab are explained in Chapter 10. Sometimes we don't record tutorials in the same order they appear online, which creates discrepancies. This is what happened here—sorry!
Additional resources
This videos goes through the process of creating a form with Drupal Forms API that is single select list that has a validation, submission and redirect functionality.
NOTE:
Their is a typo in the code displayed in the video. The function
function form_fun_cake(&$form_state)
is missing the $form paramater and should instead be
function form_fun_cake($form, &$form_state)
Curious about when you're supposed to translate "title" and when you should leave it alone? Here's the answer: You don't need to translate the 'title' attribute of an array that defines a menu item because Drupal will take care of that automatically. In fact, you shouldn't translate those as they'll end up getting double translated if you do. This is because Drupal end's up using this string of text in a number of different ways some of which don't actually need to be translated and others that do like for example when it's the title of a page or the text of a link in the menu system. The #title (and #description) property for elements in Form API array however are your responsibility to translate.
Before we can nicely publish our favorite bands’ photos on our website, we need to make sure to set up image styles, in order to create scaled-down versions of the images while leaving the original images intact. In this lesson we'll modify an existing image style to customize it, and also see how we can improve our image quality.
Additional resources
The Media module for Drupal 7 solves a number of long-standing media-related problems in Drupal. At its core, Media provides a framework to manage media assets on a Drupal site, regardless of whether those assets exist on the site’s server or somewhere else on the Internet. Media has had much active development over time, and was a moving target when Using Drupal was written, so the latest version of Media is a fair bit different from the version we cover in this lesson, "2.0-unstable3." Version 2 of Media is very, very different from version 1, which is a much older version. We highly recommend that you learn the fundamental pieces of Media 2.0 using the source code that comes with the book and is covered in the About the Using Drupal series. That will allow you to follow the lesson without getting lost in the changes. Then, when you upgrade to the latest version down the road, you will have a solid foundation to explore the newer versions.
Additional resources
To get our music reviews built, we need to get started with a new content type. In this lesson we will get the basics in place by creating the new content type, with our main fields, and the ability to upload an image.
Additional resources
Now that users can post reviews on the Band Wagon site, we need to make sure that the content they publish, including their intro photos, is actually displayed correctly. To accomplish that, in this lesson, we're going to configure the field display settings and apply image styles.
Additional resources
We now have a site with most of the basic functionality the Band Wagon project needs to start. However, one important piece remains: streamlining the content editing process, and allowing easy image and video integration in posts. In this lesson we will compare content editing tools and discuss how to integrate our media directly into the body of our content.
Additional resources
Text formats are an important security feature of Drupal, so it pays to understand them. A text format will “scan” your content and make HTML formatting changes to it before sending it to the browser for display. In this lesson we'll see what formats and filters are, and how they relate to each other, walk through the filter workflow, as well as reviewing the default formats that come with Drupal core.
Additional resources
Let’s set up the WYSYWIG editor for the Band Wagon website, using the WYSIWYG module and CKEditor. Note that if you prefer a different WYSIWYG editor, such as TinyMCE or Aloha, the installation instructions are very similar. In this lesson we'll we'll not only get WYSIWYG set up, but we'll also enable the Media filter and integrate that with our WYSIWYG editor.
Additional resources
The Media module for Drupal 7 not only supports adding and managing media that is uploaded from a user’s computer into Drupal, but it also comes with a submodule, called Media Internet Sources, that allows using media assets from various Internet locations. In this lesson we'll look at what media internet sources can do for us and quickly explain what stream wrappers are and how they relate to what we want to do on the site.