Drupal Blogs, News, Modules and Themes

Syndicate content
Drupal news from various sources around the blogosphere
Updated: 3 days 9 hours ago

Dale McGladdery: Creating and Updating Nodes Programmatically in Drupal 7

Wed, 09/01/2010 - 02:52

The steps for programmatically creating a node are:

  • Create a PHP object representing the node data
  • Save the object using the node_save() function

While the mechanics are simple, there is an important responsibility involved. The Drupal work flow does data validation before calling the node_save() function; node_save() does no validation. By calling node_save() directly your code takes the responsibility for providing valid data.

Drupal 7 Changes

A quick note for those of you familiar with Drupal 6. You'll notice two changes in Drupal 7:

Body Field Is No Longer Special

In Drupal 6 the body field was special. Specifically, it had a different data structure than other fields and it always existed, even if it wasn't used. With Drupal 7 the body field is a standard field provided by core and is truly optional.

Language

Language specification is required for the node and some fields.

Basic Node Creation

The following code assumes an unchanged Drupal 7 Standard installation and will create a Drupal 7 article node.

read more

The influence of subtlety

Wed, 09/01/2010 - 01:07

I was the first woman at any DrupalCON, the only woman in Antwerp. Until the brouhaha over the keynote, I never really thought about why I went there in the first place. But the decision to travel there was triggered by a tiny and important event, so I'd like to share it.

I had been communicating back and forth with Matt Westgate about some e-commerce functionality. At the end of one of his emails, he tacked on the following:

PS - You headed to Belgium?

This question wasn't a part of an outreach initiative to involve women in open source. I doubt he questioned that my interest might be affected by my gender. It was simply, "we're having an interesting conversation that would be even easier to have in person". Before I read that email, the thought of traveling to DrupalCON hadn't crossed my mind. But my response to that simple question was to make it happen! And thus my life was changed.

But five years later in San Francisco, when the number of women in attendance had risen from 1 to 300, I was settling into a BoF session when I was presented with another innocuous question:

This is a technical BoF. Are you sure this is where you intended to be?

This question was not intentionally harmful. It was an offer of help, in a tone of "hey, do you need some help finding your way to a session you might enjoy more?". But this "help" was based on the unconfirmed likelihood that I might not belong in a technical session. If I was new, I might have doubted my own aptitude and diminished my participation.

This post is not about lambasting the BoF guy or calling out the similar encounters we encounter every day, such as asking if I'm on the documentation team, a designer, or just there with my partner. This happens regularly and quite cordially, usually perpetrated by someone who you wouldn't call 'sexist'. But good or bad, tiny exchanges make up our community as a whole, and have a much broader impact. What if Matt, without any derogatory judgment, questioned my interest in showing up in Antwerp? What if he hadn't bothered to ask? Five years later, would I be contributing to Drupal, running a company that employs other Drupal contributors, and helping to support the local Drupal community?

More importantly, what if more people reach out to others in similar ways? How many others would there be out there doing more good for Drupal? Setting aside the topic of what is/isn't "offensive", how do we focus on being more inspirational, and asking questions instead of making assumptions?

Drupalchix

Appnovation Technologies: Nodequeue and Views Combination.

Tue, 08/31/2010 - 23:31
Tue, Aug 31, 2010 by Alla

Sometimes it is really hard to show only the needed nodes in the needed order using views only.
Here are some examples when you need to give a Content Manager (CM) some control over the nodes that will be displayed by the view:
- you need to promote on the front page some content Item (for ex., some new Game) and want the CM to be able to change it through the UI any time he pleased

- you need to show the newest Games in the block (sorted by some date), but you need to give the CM ability to override this list and show a couple of Games of their choice at the top of the list (following by rest of the newest Games sorted by a date)

- you need to show a list of Items of some Type, but to make sure that some of the Items (from some "black list") will never be included into this list.

The Nodequeue and Views modules will be a very useful combination here.

Metal Toad: What's in a framework, experiences from Rails and Drupal

Tue, 08/31/2010 - 21:39

I've now been working professionally in Drupal for a year and have learned a lot about it; I have some patches into contrib but I've not really done much with core other than some simpletests I was too shy to commit at Drupalcon and some comments trying to help people out on d.o. Prior to my stint as Drupal programmer I was a hardcore Ruby on Rails developer for about 4 years. Over the last two years in particular I've learned a lot about frameworks and I'd like to share an observation about which framework feels right to me for which situations and why.

Metal Toad: Semantic Views is Awesome

Tue, 08/31/2010 - 21:03

Like any Drupal themer, I've done my share of grumbling about the frequently ridiculous level of nested divs with dozens of classes. I'd heard some people mention a module called Semantic Views, but I never really understood what it was for until I found this video. If you don't understand what the big deal is either, take the four minutes to watch. It's a total "ah-ha!" moment. I'm happy to say that I just used Semantic Views for the first time on a client site, and it's just as awesome as everyone says. It saved me a ton of work and let me get exactly the markup I wanted, even while working around Chuck's nested views.

Vladimir Zlatanov: Entities, Bundles, Fields and Field instances

Tue, 08/31/2010 - 20:04

Drupal 7 introduces a number of new apis and with those comes new jargon. Untangling that could be daunting. I'll try to briefly sketch what is what and relate it to terminology outside of the Drupal world.

This post is a work in progress, I am regularly revising the text from feedback.

Note Revised paragraph order and wording, clarified wording of definitions, added references, corrected glitches

read more

Lullabot: Drupal Voices 158: Emma Jane Hogbin on PHP for Designers

Tue, 08/31/2010 - 16:48

Emma Jane Hobgin (aka emmajane) gives an overview of her DrupalCon San Francisco presentation on PHP for Designers. She talks about the importance of pattern recognition and forensic coding, some helpful modules such as Devel Themer as well as some of the basics of Drupal theming with tpl.php files and preprocess functions within the template.php.

For more information, be sure to check out her PHP for Designers presentation.

read more

Views Dynamic Fields

Tue, 08/31/2010 - 16:08

The Views Dynamic Fields module provides a filter for use with Views module. This filter allows the user to pick and choose which fields to display for a rendered instance of a view for that user. This provides a customized view instance for each user.

read more

John Albin Wilkins: Converting a Subversion repository to Git, (7 steps to migrate a complete mirror of svn in git)

Tue, 08/31/2010 - 13:58

When I first realized that I needed a version control system, the best system at the time was CVS. (No, really.) Subversion was nearing 1.0, so I waited for its release and then used it everywhere. Well, that was 2003. Time for a change.

This past year, it became obvious that there were many Git users within the Drupal community, so Drupal has decided to move to Git. Since then I've started learning and researching the best ways to convert all my development to a Git-based workflow. So far… it rocks.

read more

Engineered Web: Performance Is Green

Tue, 08/31/2010 - 13:17

Are you writing and using environmentally friendly software? Have you ever thought of the impact on the environment for the software you've written? Working in front of a computer it can be easy to overlook the impact on the environment due to what were creating. It's not like drinking a beverage out of a styrofoam cup (they don't break down). But, there is an impact. As Internet usage grows in leaps and bounds we need to start taking a closer look at that impact and doing something about it.

Why Performance Is Green

Why did Facebook start using Hip-Hop? According to their blog,

With HipHop we've reduced the CPU usage on our Web servers on average by about fifty percent, depending on the page. Less CPU means fewer servers, which means less overhead.

When we have less servers we use less power, we need less space in buildings, less servers need to be built for our tasks and our overall footprint is smaller.

Think about it like this. We buy energy efficient appliances, we talk about turning lights off when we aren't using them, we look at energy efficient cars, and we think about being environmentally conscious. So, why not extend this to what powers our websites.

read more

Gábor Hojtsy: How Drupal improves and evolves, the basics behind the community

Tue, 08/31/2010 - 12:48

It is that phase of my life! I'm just turning 30 in a month, working with Drupal for 7 years and just had my third Acquia anniversary a week ago. Time to look back and evaluate how things went, all the good and bad things; even better if the wisdom can be shared with others. This was part of my thinking when I submitted the session titled "Come for the software, stay for the community" for Drupalcon Copenhagen. I was interested to distill and share how Drupal came to be as unstoppable as it is, what core values lie behind it, so someone coming fresh can understand and integrate with these.

When Dries Buytaert started Drupal he made a few key decisions which launched the project and kept being governing principles ever since. First of all he decided to make it free and open source, and release it under the GPL. The choice of one single license helps you use all the Drupal components together without the requirement to consult lawyers. Also, the choice of GPL in particular ensures that derivative works are distributed in the open as well.

read more

Matthew Saunders: Drupalcon CPH - Commerce Guys Talk Drupal Commerce

Tue, 08/31/2010 - 12:33

Ryan did a session on the new version of the D7 Commerce Module. He was the original writer of the Ubercart package - a main stay of ecommerce sites in Drupal 6. His self deprecating humour at the beginning of the session was charming as Ubercart was his first segue into many aspects of Drupal and it has become the defacto leader of the pack for Drupal ecommerce sites.

His new offering is looking very slick, making use of fields in core for example, and while Ryan tells us it isn't quite ready for primetime (he's still building out features) it looked pretty good.

Video from this session is below in seven sections. The original first video was only 4 seconds long.

read more

Kristof De Jaeger: Benchmarks for the Display Suite module

Tue, 08/31/2010 - 12:16

I've been promising benchmarks for the Display Suite module after every presentation I gave so far. It took me a while to get a good setup but now it's here. I've used the demo site as a start, so there are a lot of modules enabled for this test. Views, panels, fivestar, heartbeat, comment, taxonomy, location, gmap, imagecache are the most important ones since they all integrate with the ecosphere of Display Suite modules.

I added a new content type called 'benchmark' and added 14 CCK fields to it: 4 textfields, 4 textareas, 2 images, 2 filefields, 1 node reference and 1 user reference. It also has a title, body, 2 taxonomy fields, a fivestar widget and a couple of comments.

Depending on the test, the complete set of modules integrating with Display suite are enabled or disabled. These include ds, ds_ui, cd, hds, nd, nd_cck, nd_search, nd_fivestar, nd_location, nd_switch_bm, ucd, ud and vd. You gotta love small project names right ?
<!--break-->

Desktop

The first test was ran on my Fedora Core 13 desktop - Intel Core Quad, 2 GHz, 2MB RAM with php 5.2.13 and eAccelerator - ab sending 100 requests with 5 concurrent users on a single node and page caching disabled.

read more

aCoffee

Tue, 08/31/2010 - 11:54

aCoffee theme is the one-or-two-columns Free Drupal theme with a fixed width. There are some icons for Twitter, RSS and a forum and a favicon. Rich green and warm brown colors create an impression of comfort. This theme is perfectly suitable for a blog, websites of cafe and web-cafe-guides with news, reviews and comments.

Features:
  • Columns: 1 or 2.
  • 12 regions.
  • Cross-Browser tested:
    Firefox 3, Internet Explorer 7 and 8, Opera 9.5+, Google Chrome and Safari 3 and 4.
  • Width: Fixed, 970 px.
  • Color: green, brown.
  • Valid XHTML and CSS.

I Can Localize: How to Translate Interface Strings

Tue, 08/31/2010 - 11:02

Translating interface strings is always a painful process. Actually, it's difficult to achieve in many content management systems, not just in Drupal.

Unlike node contents, interface strings can come from many different places.

They can be part of Drupal core, from modules, themes or dynamically generated by the site's admin.

The hard part is locating these interface strings which appear to site visitors and translating them. To visitors, it doesn't really matter where the strings come from. All user-facing strings must be translated, for the entire page to appear in the right language.

Choosing Strings With The Localization Client Module

The localization client allows searching for untranslated strings easily. For site admins, the most important feature is the ability to spot strings as they are used on public pages.

Once installed and enabled, the Localization Client opens a panel at the bottom of public pages. These pages are viewable to admins only and not to site visitors.

read more

Lullabot: Command Line Basics: More Editing with Vi/Vim

Tue, 08/31/2010 - 10:43
Replace text, copy/paste, and visual mode

This video picks up where we left off in the Editing with Vi/Vim video. This time we take a look at some shortcuts for replacing text, how to copy/paste, and the cool visual mode feature you get with Vim.

Scott Hadfield: Drupalcon is dead. Long live Drupalcon?

Tue, 08/31/2010 - 07:11

With Drupalcon Copenhagen now behind us and Drupalcon Chicago approaching, I've found myself thinking about what Drupalcon is and how it's changing.

My first Drupalcon was in Barcelona, I was lucky enough to get to tag along with the guys from Bryght. I had an absolutely amazing time and met dozens of people, many of whom are now quite close friends. To top it off I also met my now fiancee and a future boss (no longer my boss, but still a good friend).

Since then, the twice yearly Drupalcons have consistently been highlights in my year. It's often the only time I get to see many of my friends in person.

read more

Matthew Saunders: Drupalcon CPH - The Final Session

Tue, 08/31/2010 - 04:05

Many thanks to everyone who made Drupalcon CPH happen. The final session is a suitable (if silly) ending to what was a very productive week for me. Lots of meetings, reconnecting with old friends, and sessions.

The greatest silliness and fun in the session were the Kitten Killers - you can see just that piece of the presentation here (again and again and again).

If you just want to see the final session from beginning to end - I've posted the entire session below. The second to last is the Kitten Killers.

read more

Media: Comedy Central

Mon, 08/30/2010 - 22:33

Media: Comedy Central is an Embedded Media Field for comedycentral.com videos.

It should support videos from any comedycentral subsite (e.g. http://www.thedailyshow.com/)

Media: TED

Mon, 08/30/2010 - 22:08

Media: TED is an Embedded Media Field provider for ted.com

It accepts both the default TED embed code and the Wordpress.com shortcode (e.g. [ted id=319] )