Planet Drupal
Digett: Review: Acquia Webinar on Profiting from Drupal-Powered Semantics
Back in June of last year when Google, Bing and Yahoo! introduced Schema.org I wrote about how it would be a game changer for the semantic web. The problem was that it was difficult at best to implement semantic vocabulary on a website, even in Drupal 7. But that has all changed now.
My Drupal Journey: Hiding Empty Shopping Carts in D7 Commerce
I am just starting to get familiar with Drupal 7's Commerce modules. The first thing I noticed after enabling the standard Commerce modules was that doing so created a Shopping Cart Block that could be added to any Region. However, placing the default shopping cart block into a region caused the block to be shown at all times, even if it was empty. While some may define this always visibable (and often empty) shopping cart as a subconscious "call to action", I find it simply annoying.
I confess that in several day dreaming sessions, Acquia has puts me up for a few weeks to teach me how to code Drupal to accomplish my requirements. But in the real world, I have to look for non-coding ways to accomplish what I want by using modules and methods already provided by people who are a lot more knowledgeable about such things. In researching this issue/desire, I came across a threaded discussion in which Ryan Szrama, the author of Drupal Commerce, wrote "...you don't actually have to use the core cart block at all. You can still use the same View and just add a Block display to it. Disable the core block and voila! Hide when empty will probably work just fine." Several posters after which continued to discuss coding fixes to hide empty shopping carts.
Crickets sounds.....
Mearra: Some tools to aid your Drupal admin pain
I think we have all felt the pain at least sometimes when doing admin tasks on the Drupal backend. Trying to find your way to the right admin page without knowing the correct path, trying to find some module in the modules page and activate it etc. With the built-in basic tools it can be pretty frustrating. But worry no more because here I present you some cool modules to aid your admin pain!
Administration menu Administration menu provides a theme-independent administration interface. This module is a real time saver for all types of users. You get fast access to all the sub admin pages through the CSS/JS-based dropdown menu at the top on all pages of your site. But the functionality presented doesn't limit to just regular menu items — tasks and all kinds of actions are also listed in the menu. This enables fast access to your every day tasks. You can find a demonstration of this module from here http://www.unleashedmind.com/drupal/admin_menu/.[http://drupal.org/project/admin_menu]
AlohaAloha module integrates the excellent HTML5 wysiwyg editor Aloha Editor (http://aloha-editor.org/) to Drupal. With Aloha you don't have to press the edit link of an page or article when you want to make small changes but you can do it straight in the front end! Fixing typos and adding some text hasn't been this easy&fast before. Think how much time you can save while using this module! You can find a demonstration of this module from here http://aloha.dev.mearra.com.
[http://drupal.org/project/aloha]
CoffeePerformance junkies like me like to do most of the tasks from the keyboard without the need to use your mouse/touchpad/whatever. For example in OS X people use tools like Spotlight, Alfred or LaunchBar to do all kind of tasks just using the keyboard. Well now you can use the same behavior in Drupal too! Just install Coffee and press alt+d (alt + shift + D in Opera, alt + ctrl + D in Windows Internet Explorer) and you get a Alfred-like popup where you can just start typing page names or whatever where you want to navigate. You can even define your own commands in your module with hook_coffee_command() see coffee.api.php for further documentation. You can see Coffee module in action in this screencast http://www.youtube.com/watch?v=ikGJl69jPJw.
[http://drupal.org/project/coffee]
Module filterWhile the module listing on modules page can get pretty long Module filter module comes in the rescue! With this module you can filter the modules list by either typing some keywords or using the module category listing to limit the amount of modules shown. With this module you can quickly find the module(s) you were trying to find and enable/disable them. A real life saver when handling modules!
[http://drupal.org/project/module_filter]
So what are your favorites? Are there some other modules that fall into this category and belong to your basic stack of modules that you use on every page you administer?
Drupalize.Me: Introduction to Drupal Commerce Basics
We kick off the Commerce Basics series with a look at the LB Robotics store site that we will be building. Ryan gives a quick tour of the site and discusses the main topics we will be focusing on, like products, taxes, discounts, checkout, and general configuration of our store.
Drupal Commerce relies heavily on the Views and Rules modules for many of its features, which allow you a lot of customization. If you need a refresher on these two modules, you can watch these other Drupalize.Me series:
5m Publication date February 22, 2012 - 7:00amDrupalize.Me: Adding Product Displays
Now that we have created our products we'll dive into the Product display content type so that we can display our products to our users. In this instance we'll start out be re-using the nodes created by Commerce Kickstart, then we create two new displays for our remaining items. We finish up by rearranging the fields on the content type using Drupal 7's manage display configuration.
8m Publication date February 22, 2012 - 7:00amRowlands Group: Programmatically Insert Local Files to Managed Files
As numerous posts out there state, this is the way to programmatically add files into Drupal 7's file module tables.
<?php
// Load the files contents
$image = file_get_contents(<path to file>);
// Returns the new file object
$file = file_save_data($image, 'public://<filename>', FILE_EXISTS_RENAME);
?>
However after working on the module CCTV (Currently getting approval for Full Project) I found that this was not enough.
For some background details, CCTV is a module that turns your Drupal site into a IP Camera capture application. Based on the users preference the application can save files up to 1 day in file size (which equates to a very large file). Due to the large file sizes generated by CCTV php runs into memory both max file php configuration and local allocated memory issues. So how do we get around this?
After digging through the file modules documentation I found the following solution.
<?php
$handle = fopen('<path to local file>', 'r');
$file = file_save_data(fopen($handle, 'r'), 'public://<filename>');
fclose($handle);
?>
This opens the file in read only mode and using the file module's function file_save_data it copies the file to the public:// file system. This not only makes your code more efficient, but also allows for bypassing around php's max file size constraints.
Category: Drupal Planetvar switchTo5x=true; stLight.options({publisher:'dr-5d208cf3-1548-8519-cb10-a07ce4f152ee'});Drupalcon: DrupalCon Training: Making the Switch (for Experienced Developers Moving to Drupal)
If you are an experienced developer ready to dive into Drupal, then take a look at the pre-conference training session “Making the Switch to Drupal.” This March 19, day long course is led by Jeff Beeman, Josh Brauer, and Chris Porter - three experts from the Drupal powerhouse Acquia. With years of experience in both Drupal development and training, you can be confident that you’ll leave with a great perspective on what Drupal can do for you - and you’ll have a great time in the process.
Through hands-on activities, several key topics in Drupal site building will be covered:
- Identification of skills needed for Drupal development.
- Strategies for building maintainable, scalable web sites.
- Module selection, configuration, and customization.
- Explanation of the different Drupal data types and when to employ them - including content types, taxonomies, and views.
- Best practices for Drupal code development.
- Navigation of the Drupal community and how to find help.
Although no prior Drupal experience is required, it will be helpful to have knowledge of CSS, HTML, as well as a programming language such as PHP, .NET, or Java.
This pre-conference training session is held on Monday, March 19, 2012 - the day before the conference begins. Therefore, you won’t have to worry about missing any valuable conference events if you decide to enroll in this course.
Visit Acquia’s blog for more detail, or visit the bottom of the registration page if you’re ready to sign up.
LevelTen Interactive: Quick Enhancements to Make Drupal Content Admin Dirt Simple
There is no doubt that Drupal 7's admin is light years better from a usability perspective. Yet, even with all the enhancements, we find site admins still stumbling to manage their content. Over the last few months we have worked out a set of enhancements that have made our clients lives much easier. So we thought we would share.
Drupal core announcements: Drupal 8 feature freeze: December 1st, 2012
For those who missed it, the Drupal 8 feature freeze date was announced at http://buytaert.net/drupal-8-feature-freeze-december-1st-2012 as December 1, 2012. That means if there's something you want to see in Drupal 8, now is the time to make it happen. By this time next year, we'll be in polishing and bug fix phase.
CoreUrban Insight: SimpleAds: A new advertisement module for Drupal 7
A few months ago I had to develop a Drupal 7 website that was supported by advertising.
After some research I realized that there were no current advertising modules for Drupal 7.
The Advertisement module is the de facto advertisement module for Drupal but a Drupal 7
version wasn't even under development.
So I decided to develop a new contrib module for featuring advertisements on Drupal 7 that was easy-to-use and provided
Evolving Web: Understanding the Entity API Module
Entities in Drupal 7 simplify and centralize common logic that, in earlier versions of Drupal, was duplicated in several places, or only usable in specific modules. There are, however, many features (such as saving entities!) that did not make it into Drupal 7. The Entity API module fills in these missing gaps in the core and goes a step farther by simplifying definition of new entity types, and integration with contrib modules such as Views, Rules, and Features.
braahm: Combine several select queries into one with union
I wanted to create a view which lists all nodes of different content types that link to the current node displayed on the page. The nodes link via node reference. Since node references only work in one way, and I wanted to get the node references of different content types linking to the current node, I couldn't (didn't know) how to achieve this easily with just a plain view.
The solution I came about was to embed a view to display the different nodes that link to the current one, and feed that view a list of node ids of the linked nodes.
Four different content types with four different node reference fields linked to our node. To get the nids we need to query four different tables.
To get the nids from the four tables in one trip to the database, we can use the union syntax.
Drupal DatabaseAPI union syntax- Create the different select queries.
- Union the queries to each other like below
$subquery_1->union($subquery_2)->union($subquery_3)->union($subquery_4); - Execute the first query.
Below you find the actual queries to query four different node reference tables.
/** * field_data_field_col_ref_place * field_data_field_entity_ref_place * field_data_field_occ_ref_place * field_data_field_place_ref_place */ $subquery_1 = db_select('field_data_field_col_ref_place', 'cp') ->condition('cp.field_col_ref_place_target_id', $nid, '=') ->fields('cp', array('entity_id')); $subquery_2 = db_select('field_data_field_entity_ref_place', 'ep') ->condition('ep.field_entity_ref_place_target_id', $nid, '=') ->fields('ep', array('entity_id')); $subquery_3 = db_select('field_data_field_occ_ref_place', 'op') ->condition('op.field_occ_ref_place_target_id', $nid, '=') ->fields('op', array('entity_id')); $subquery_4 = db_select('field_data_field_place_ref_place', 'pp') ->condition('pp.entity_id', $nid, '=') ->fields('pp', array('field_place_ref_place_target_id')); $subquery_1->union($subquery_2)->union($subquery_3)->union($subquery_4); $nids = $subquery_1->execute()->fetchCol(); Remarks
The items you retrieve need to be of the same type (for example integers) or a union won't be possible.
Tags: drupaldatabaseAPIplanet drupalDoug Vann: Announcing Blue Drop Awards 2012
We are inviting YOU, The Drupal Community, to join us for the first ever
CiviCRM Blog: Webforms for CiviCRM 4.1
If you've recently upgraded to CiviCRM 4.1, you'll need to upgrade your webform_civicrm as well. Versions 2.3 and below are not fully compatible with Civi 4.1. Version 2.4 is, and will be released in the next couple of days, especially if I get a few comments on this post from people who have sucessfully tested it! The latest -dev is stable and working, so please feel free to download it and try it out on your 4.1 site!
Note: webform_civicrm 2.4 is not backwards-compatible with older versions of CiviCRM, and should only be used with 4.1.x
New Features In webform_civicrm 2.4- Adds contact image and language pref fields
- More options for matching/updating existing activities
- Support for new multi-valued contact sub-type
- Improved group and tag fields
- Can include the entire webform submission in the activity details, as well as an edit link
- Can generate a contact checksum for use in webform-generated emails
- Supports cid1=0 in URL, so the "not you" link no longer logs you out
- Support custom data for cases
This version also has some behind-the-scenes enhancements to improve efficiency, compatibility, and pave the way for future improvements. As always, Drupal 6 and 7 are both supported :)
Tree House Agency: 'OR' Queries with EntityFieldQuery
As we outlined in a previous post about building the Energy.gov platform without Views, extending EntityFieldQuery (EFQ) is essential to our development philosophy.
Cocomore: What to look forward to in Drupal 8 (and how you can help)
I was already planning to provide an overview of what’s been going on in the various Drupal 8 initiatives even before last week, when Dries announced the timeline for Drupal 8, which includes a “feature freeze” for Drupal 8 in only a little more than nine months from now, and planned release at the DrupalCon Europe, in late August 2013.
Drupal 7’s Plateau of Productivity?While most of the top Drupal 6 modules are now available, in some state or another, for Drupal 7, and I would certainly choose Drupal 7 for a large Drupal-based project that is not expected to be deployed for some time, from the outcry of protests I think there are a lot of people who would not agree that Drupal 7 is yet at its Plateau of Productivity. I would choose development in Drupal 7 for most projects, but there is still plenty of reason for site builders to work with Drupal 6, especially if they need particular features (e.g Nodewords / Metatag functioning properly, among others) and if they need to deploy the site now, with those features ready for use. Dries indicated that he thought Drupal 6 reached its Plateau of Productivity in late 2009, about 18 months after its initial release. At that point, there were fewer than 20,000 sites using Drupal 5 and more than 200,000 sites using Drupal 6. While this order-of-magnitude-greater-usage is not likely to ever be seen comparing Drupal 7 vs Drupal 6 usage (at least not before Drupal 8 is released), I do think that it’s significant that Drupal 7 usage has finally overtaken Drupal 6. That said, I don’t think we are truly at Drupal 7’s Plateau of Productivity, the point where building a new site on Drupal 6 would be “pointless”. Both in terms of time-after-release and usage statistics, it is arguably premature to say we are quite to that point yet.
Quibbling aside, I also don’t think it matters whether we believe we have reached the Plateau of Productivity for Drupal 7, or not — and it certainly doesn’t matter whether we are all in agreement about that. I do think Drupal 7 is very “ready for use”, though and I do think we are ready to see core development for Drupal 8 get kicked into high gear and I don’t think it will significantly delay the development of certain lagging contrib modules or resolving core issues in Drupal 7 which are the final barrier, in my view, to truly reaching its Plateau of Productivity. Additionally, many of the fixes and features going into Drupal 8 are regularly being back-ported to Drupal 7, and there is increased discussion of relaxing the criteria for what can be back-ported to Drupal 7, so I see the increased attention to Drupal 8 core development as exciting: a win-win for the whole Drupal community. We now have a release date for Drupal 8, which is important for business decisions, and a better timeline to facilitate a roadmap for the final stages of determining feature inclusion.
Drupal 8 Core InitiativesCurrently there are 6 official Drupal 8 Core Initiatives which are working on various aspects of desired improvements to core. There are others likely to be added to the list as soon as a bit more progress has been made on the current list and/or as qualified individuals step up to take on some of the other “top 10” desired improvements we had on our collective community wishlist. Some of the improvements require fixes to issues plaguing Drupal 7 and 6 and have been backported. Most of the others involve dozens, if not hundreds, of related issues. Following is a brief summary of each of the current core initiatives and what their priority goals are for Drupal 8. In the interest of brevity, the explanations leave out a lot of juicy details, but for those who haven’t been paying close attention and who might like to get involved, I hope this summary is useful:
Web Services and Context Core InitiativeThe Web Services and Context Core Initiative (WSCCI, pronounced “Whiskey”), formerly referred to as the “Butler” project, is a core initiative led by Larry Garfield of Palantir.net, aka “Crell” on Drupal.org. While the traditionally typical HTTP request has been for HTML pages, the modern Web has brought with it the need for HTTP services which deliver information which is not necessarily in the form of HTML. This is especially true for mobile applications, but also applies to feeds and other communications via HTTP. The goal is to “take Drupal from being a first-class Web CMS to being a first-class REST server which includes a first-class Web CMS”. Really, this initiative spans a huge range of related issues and without writing an article many times the length of this one, I could not possibly cover everything, but…
Matthew Saunders: Drupalcon Denver - Feb 21, 2012 - LAST DAY FOR EARLY BIRD PRICING
Want to save $50? If you're planning on going to Drupalcon Denver today is the last possible day to get in at the early bird pricing. At midnight Mountain Time, the price goes from $350 to $400. That extra $50 in Denver would a REALLY nice meal for a couple of people with drinks. It could get two people into the official party. It is an Association membership with $20 left over. Come on? What are you waiting for? REGISTER today to access more than 104 sessions including core conversations, three GREAT keynotes, more Birds of a Feather conversations than you can shake a stick at. That does not even include the networking opportunities.
If you register today, that comes to $70/day. That increases by $10/day tonight (February 21/2012) at midnight.
Commerce Guys: Commerce Module Tuesday: Commerce Product Display Manager
Discover Commerce Product Display Manager (shortname: commerce_pdm) in this new Commerce Module Tuesday screencast and see how to make product management easier for your commerce website.
Commerce Product Display Manager enables two UI features, the first one displays a widget in the product creation form and allows us to create a product display right from there or associate our product with an already created product display. The second feature of this module provides a dedicated administration screen with drag and drop capabilities to help managing products and displays.
Also in this screencast you'll find how to create product displays from product by using the rules provided here, and an alternative solution for the more code-like watchers that proposes a more advanced solution.
ComputerMinds.co.uk: Quick tips: Adding an empty master branch
When I create a git repository for a new project on Drupal.org I don't bother to create a master branch, branches named 6.x-1.x or 7.x-1.x have special meanings and are the ones that we're encouraged to use. However, drupal.org doesn't allow us to change the default branch on d.o itself, so even though there may be no branch called 'master', it's still the default branch, so sometimes cloning a repo will fail:
git clone http://git.drupal.org/sandbox/darthsteven/1268648.git Cloning into 1268648... remote: Counting objects: 177, done. remote: Compressing objects: 100% (176/176), done. remote: Total 177 (delta 103), reused 0 (delta 0) Receiving objects: 100% (177/177), 41.22 KiB, done. Resolving deltas: 100% (103/103), done. warning: remote HEAD refers to nonexistent ref, unable to checkout.This is a bit nasty, and you can force people to use the branch name when cloning:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/darthsteven/1268648.gitWhich is what drupal.org will tell people to do on the version control tab.
The real fixThe correct way to get this fixed would be to get this issue about setting a default branch committed and deployed to Drupal.org. But, who knows when that will happen?
A workaroundAs an interim workaround that will mean that people cloning your repo don't get an error if they don't specify a branch you can create and push a master branch to the repo.
The best way to do this is to follow the instructions below which basically creates an entire new git tree to work in and pushes that into the master branch. This means that your actual branches and the master branch share no commits at all.
Get yourself a nice clean checkout of your repo, and make sure you really don't have a master branch (if you do you don't need to follow these instructions anyway!)
Then run:
cd /path/to/repo git symbolic-ref HEAD refs/heads/master rm .git/index git clean -fdx echo "Real code is not kept on the master branch, see one of the other versioned branches instead" > README.txt git add README.txt git commit -m "Add a master branch." git push origin masterYou will then have a master branch that contains a single commit, with a single file that tells people to look elsewhere for the code.
Larry Garfield: Refocusing WSCCI
As Dries has already reported, we held a summit meeting at the Acquia offices in Boston last week. It was a good sprint for a couple of reasons. For one, a large number of leading core developers got more clearly on the same page about the direction of Drupal core. For another, we were able to break the "too big to swallow" logjam that has been plaguing the Web Services and Context Core Initiative (WSCCI).
