Skip to Content

Drupal

Code Karate: Drupal Views Module: Creating lists of content on your Drupal site

Planet Drupal - 17 April 2015 - 12:14pm
Episode Number: 203

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 in almost every Drupal 7 website I build. It’s so popular in fact that it’s included in Drupal 8 by default.

Tags: DrupalViewsDrupal 7Site BuildingDrupal Planet
Categories: Drupal

Drupal.org Featured Case Studies: National Baseball Hall of Fame and Museum

Planet Drupal - 17 April 2015 - 11:30am
Completed Drupal site or project URL: http://www.baseballhall.org/

The National Baseball Hall of Fame and Museum (BHoF) is an American institution. For 75 years they have housed the archive of America's favorite game, welcoming new inductees each year and connecting generations with their huge love and knowledge of the sport.

BHoF has a large and dedicated audience, but their location in Central New York limits the number of physical visits to the museum. To reach a wider audience, they needed to unlock the full potential of their online presence.

Cogapp helps organizations use digital media, specializing in large-scale, mission-critical projects for prominent institutions.

BHoF appointed Cogapp to perform a discovery phase to research user engagement, the kinds of content that are of interest to users, and key value propositions of the website to its visitors. This work then fed into developing the site, with the central objective being to showcase the vast number of artifacts in the Hall's collection, creating connections that bring these objects to life for site visitors.

Key modules/theme/distribution used: Islandora Imagecache ExternalParagraphsEntity APIMetatagFeaturesStrongarmMasterVarnish HTTP Accelerator IntegrationOrganizations involved: CogappTeam members: alxbridgechapabutassos
Categories: Drupal

Drupal Watchdog: VIDEO: DrupalCon Amsterdam Interview: Angie Byron

Planet Drupal - 17 April 2015 - 9:59am

Angie Byron is Director of Community Development at Acquia. For this interview, during the final day of DrupalCon Amsterdam, we were able to find an empty auditorium. Alas, filming with my brand-new GoPro camera, we got off to a topsy-turvy start...

RONNIE RAY: I’ve had you upside down.

ANGIE BYRON: Oh hahaha!

I go by Angie Byron or webchick, and more people know me as webchick than Angie Byron.

Today, what I love to do at DrupalCons, on the last day of the sprint days, is just walk around all the tables and see what everyone is working on, cause there’s hundreds of people here and they’re all sort of scratching their own itches on everything from Drupal-dot-org to, like, what is the newest coolest content staging thing gonna be?, to how are we going to get Drupal 8 done?

And everybody working together and collaborating with people they don’t get to see all the time, it’s a lot of fun for me.

I feel like we made a lot of really great decisions about the Drupal 8 release management stuff here that we’ll be able to put into practice, and help try and focus efforts on getting the critical issues resolved, trying to clean up the loose ends that we still have, and getting the release out the door faster.

And the other thing I’m going to work on for the next month is something called Drupal Module Upgrader, which is the script that can help contrib modules port their modules to Drupal 8. It automates a lot of that task.

Now that Beta is here it’s a great time for people to update their modules, so I want to work on tools to help facilitate that.

RR: What are you reading, besides books on Drupal?

AB: Not much. Although I love reading kids books, because I have a daughter who’s 16 months now and she loves to be read to. So my latest books I’ve been reading are Where is the Green Sheep? and Go, Dog, Go! and a bunch of Richard Scarry stuff and things like that because she loves to know what everything’s called. She loves books.

There’s a Dr. Seuss book called Oh, The Places You’ll Go! That book is dark, man, that is like a dark book. It’s entertaining. I remember it from when I was a kid but I don’t remember it like that!

RR: Music?

AB: I listen to a lot of old music cause I’m one of those curmudgeonly people who thinks the best music was already made. So, like I’ve been having like a ‘70s rock, ‘80s pop, ‘90s punk rock, like – that’s sort of what’s in my chain all the time. Hair metal, junk like that. How to relive my kid-age stuff.

I think the community has grown to such an enormous size now that I guess one thing I wonder about, – not really worry about– but am curious about, is if can we still maintain that small-knit community feel that we had back when I started, when we were 70 people at a DrupalCon – not the 2,500 people we have now.

It’s cool to kind of walk around DrupalCon, especially on a sprint day, especially because I feel we have retained that – and people are finding people to connect with and cool things to work on and stuff like that.

I think it’s something we all need to collectively be intentional about is, you know, it’s not just enough that Drupal is just a great software project, it’s also about the people and trying to maintain that welcome feeling – that got us all in the door – for generations to come.

So that’s something I would leave as a parting note.

Tags:  DrupalCon DrupalCon Amsterdam Video Video: 
Categories: Drupal

Chapter Three: Presentation: Drupal 8 Module Development

Planet Drupal - 17 April 2015 - 9:15am

This session was presented at Bay Area Drupal Camp, San Diego Drupal Camp, Phoenix Drupal Camp, and Stanford Drupal Camp.



Have you written a few simple modules for Drupal 7, and are a little bit nervous to find out the changes you'll be facing in Drupal 8?

Categories: Drupal

Aten Design Group: Speeding up Complex Drupal Data Loads with Custom Caches

Planet Drupal - 17 April 2015 - 8:27am

Recently we had the task of loading data from a content type with 350 fields. Each node is a University’s enrollment data for one year by major, gender, minority, and a number of other categories. CSV exports of this data obviously became problematic. Even before we got to 350 fields, with the overhead of the Views module we would hit PHP timeouts when exporting all the nodes. If you’re not familiar with Drupal's database structure, each field’s data is stored in a table named ‘field_data_FIELDNAME’. Loading an entire node means JOINing the node table by entity_id with each related field table. When a node only has a handful of fields, those JOINs work fine, but at 350 fields the query runs slow.

On this site we’re also plotting some of the data using highcharts.js. We really hit a wall when trying to generate aggregate data to plot alongside a single university's. This meant loading every node of this content type to calculate the averages, which turned our slow query into a very slow query. We even hit a limit on the number of database JOINs that can be done at one time.

In retrospect this is a perfect case for a custom entity, but we already had thousands of nodes in the existing content type. Migrating them and implementing a custom entity was no longer a good use of time. Instead, we added a custom table that keeps all the single value fields in a serialized string.

The table gets defined with a hook_schema in our module's .install file:

function ncwit_charts_schema() {   $schema['ncwit_charts_inst_data'] = array( 'description' => 'Table for serialized institution data.', 'fields' => array( 'nid' => array( 'type' => 'int', 'default' => 0, 'not null' => TRUE, 'description' => 'node id for this row', ), 'tid' => array( 'type' => 'int', 'default' => 0, 'not null' => TRUE, 'description' => 'intitution term id that this data belongs to', ), 'year' => array( 'type' => 'int', 'default' => 0, 'not null' => TRUE, 'description' => 'school year for this node', ), 'data' => array( 'type' => 'blob', 'not null' => FALSE, 'size' => 'big', 'serialize' => TRUE, 'description' => 'A serialized array of name value pairs that store the field data for a survey data node.', ), ), 'primary key' => array('nid'), );   return $schema; }

The most important part of the array is 'data' with type 'blob', which can be up to 65kB. Not shown is another array to create a table for our aggregate data.

When a new node is saved hook_node_insert() is invoked. hook_node_update() fires both when a new node is saved and when it's updated.

/** * Implements hook_node_insert(). * save serialized field data to inst_data table for a new node * For a new node, have to use this */ function ncwit_charts_node_insert($node) { ncwit_charts_serialize_save($node); }     /** * Implements hook_node_update(). * save serialized field data to inst_data table */ function ncwit_charts_node_update($node) { if (isset($node->nid)) { // we're also calling this function from hook_node_insert // because hook_node_update doesn't have the nid if is a new node ncwit_charts_serialize_save($node); } else { return; } }

Now we actually process the fields to be serialized and store. This section will vary greatly depending on your fields.

function ncwit_charts_serialize_save($node) { // save each value as a simple key => value item foreach ($node as $key => $value) { $data[$key] = $value[LANGUAGE_NONE][0]['value']; }   $fields = array(); $fields['nid'] = $node->nid; $fields['tid'] = $node->field_institution_term[LANGUAGE_NONE][0]['tid']; $fields['year'] = $node->field_school_year[LANGUAGE_NONE][0]['value']; $fields['data'] = serialize($data);   db_merge('ncwit_charts_inst_data') ->key(array( 'nid' => $node->nid, )) ->fields($fields) ->execute();

When a node is deleted we have some clean-up to do.

/** * Implements hook_node_delete(). * Also remove node's data from inst_data */ function ncwit_charts_node_delete($node) { if ($node->type !== 'data_survey') { //only care about data_survey nodes return; }   $query = db_select('ncwit_charts_inst_data', 'i'); $query->fields('i')->condition('i.nid', $node->nid); $result = $query->execute(); $data = $result->fetchAssoc(); if ($data > 0) { db_delete('ncwit_charts_inst_data')->condition('nid', $node->nid)->execute(); } }

When first installed or when fields get changed, we added a batch process that re-saves the serialized strings. Aggregate data is calculated during cron and saved in another table. Rather than loading every node with JOINs, the data comes from a simple query of this custom table.

Pulling the data out of the database and calling unserialize() gives us a simple associative array of the data. To pass this data to highcharts.js we have a callback defined that returns the arrays encoded as JSON. Obviously this gets more complicated when dealing with multiple languages or multi-value fields. But in our case almost everything is a simple integer.

This process of caching our nodes as serialized data changed our loading speed from painfully slow to almost instant. If you run into similar challenges, hopefully this approach will help you too.

Categories: Drupal

NovaPoshta

New Drupal Modules - 17 April 2015 - 8:14am

Documentation [TBD]

Categories: Drupal

Domain Restriction Formatter

New Drupal Modules - 17 April 2015 - 6:15am

This module exposes a formatter to hide or show fields on selected domains.
All fields in the "manage display" tabs can be configured.

Configuration

Go to Structure -> Your content type -> Manage display and start
configuring the fields you want to put restrictions on.

Supporting organizations:

Categories: Drupal

Shortcode Video

New Drupal Modules - 17 April 2015 - 3:24am

This ShortCode macro provides video embed code from various sources.

Supported providers
  • Youtube
  • Vimeo
Requirements

* Shortcode contrib project
* configure your input format to allow enter shortcode_video macro

Categories: Drupal

Entity XLIFF FTP

New Drupal Modules - 16 April 2015 - 3:49pm

Entity XLIFF FTP is a Drupal extension that introduces a localization workflow whereby editors or administrators can push XLIFF files to a remote server via SFTP, then pull down processed XLIFF files when they're ready (either manually, or automatically on cron).

This extension was designed specifically to work with SDL WorldServer, but can theoretically be used with any FTP server or FTP-enabled translation management system.

Categories: Drupal

IDNA Convert

New Drupal Modules - 16 April 2015 - 2:01pm

The module provides two functions that allow to convert domain names in Punycode to human-readable national domain names in Unicode and vice versa.

Categories: Drupal

Midwestern Mac, LLC: Thoughts on the Acquia Certified Developer - Front End Specialist Exam

Planet Drupal - 16 April 2015 - 1:34pm

Previously, I posted my thoughts on the Acquia Certified Developer - Back End Specialist exam as well as my thoughts on the Certified Developer exam. To round out the trifecta of developer-oriented exams, I took the Front End Specialist exam this morning, and am posting some observations for those interested in taking the exam.

My Theming Background

I started my Drupal journey working on design/theme-related work, and the first few Drupal themes I built were in the Drupal 5 days (I inherited some 4.7 sites, but I only really started learning how Drupal's front end worked in Drupal 5+). Luckily for me, a lot of the basics have remained the same (or at least similar) from 5-7.

For the past couple years, though, I have shied away from front end work, only doing as much as I need to keep building out features on sites like Hosted Apache Solr and Server Check.in, and making all my older Drupal sites responsive (and sometimes, mobile-first) to avoid penalization in Google's search rankings... and to build a more usable web :)

Categories: Drupal

JWT Link

New Drupal Modules - 16 April 2015 - 12:45pm
About

Produces a JWT-compliant URL based on the logged in user to authenticate on a remote server that is set in the settings.

Installation

Requires BSD-3-Clause licensed JWT class available at:
https://github.com/firebase/php-jwt

Download and extract the PHP JWT package from https://github.com/firebase/php-jwt into this module's root.

The only required file is JWT/Authentication/JWT.php

Categories: Drupal

Achieve Internet Blog: Is Your Site Ready For Google’s New Search Ranking Algorithm?

Planet Drupal - 16 April 2015 - 11:35am
How does mobile-friendliness affect Google search rankings? Google reports:
Categories: Drupal

MVPCreator Marketing

New Drupal Modules - 16 April 2015 - 10:37am

Provides some widgets for use in a Panopoly site (or Panopoly-based distribution) for creating a startup marketing site!

Includes (or will include) the following:

Categories: Drupal

Organic Groups Entityform Integration

New Drupal Modules - 16 April 2015 - 10:21am

This module integrates the Organic Groups and Entityform modules. It allows users to submit entityforms in a group context, and gives access to view/edit/delete those submissions based on organic groups membership and group-level permissions.

Some sample use cases for this module are:

Categories: Drupal

Acquia: Drupal is fun to use - meet Karen Grey

Planet Drupal - 16 April 2015 - 9:49am
Language Undefined Drupal is more fun - meet Karen Grey

I sat down with Karen Grey at Drupal Camp Brighton 2015 to find out more about who she is and what she does with Drupal. I apologize for taking her out of the code sprints for that time! Since we spoke, Karen has taken on a position as Senior Drupal Developer at i-KOS in their Brighton office.

Categories: Drupal

Drupal Watchdog: RESTful Web Services Module Basics

Planet Drupal - 16 April 2015 - 8:30am
Article

Drupal 7 does not have built-in support for representational state transfer (REST) functionality. However, the RESTful Web Services module is arguably the most efficient way to provide resource representations for all the entity types, by leveraging Drupal's powerful Entity API. Unmodified, the module makes it possible to output the instances of the core entity types – node, file, and user – in JSON or XML format. Further entity type resources and formats are possible utilizing hooks in added code.

As with any REST solution, the RESTful Web Services module supports all four of the fundamental operations of data manipulation: create, read, update, and delete (CRUD). The corresponding RESTful API HTTP methods are POST, GET, PUT, and DELETE, respectively.

Anyone hoping to learn and make use of this module – especially for the first time – will likely be frustrated by the current project documentation, which is incomplete, uneven, and lacking clear examples. This article – a brief overview – is intended to introduce what is possible with this module, and help anyone getting started with it.

We begin with a clean Drupal 7 installation (using the Standard profile) running on a virtual host with the domain name "drupal_7_test". After installing and enabling the module, we find that it does not have the configuration user interface one might expect. In the demonstration code below, we focus on the node entity type.

Nabbing a Node

The simplest operation – reading an entity instance – is performed using a simple GET request containing the machine name of the entity type and the entity's ID.

Categories: Drupal

Cache Locale

New Drupal Modules - 16 April 2015 - 7:54am

Provides a framework overriding the locale() function thereby enabling various ways of caching translations.

Requires a core patch, which is bundled with the module. The patch allows for override of the locale() function.

A couple of translation cache handlers are bundled with the module.

Installation

Apply the core patch, and enable the module.

Configuration

Use the custom cache function that comes with the Cache Locale module.

Categories: Drupal

Drupal Association News: We Love Our Volunteers!

Planet Drupal - 16 April 2015 - 7:15am

This week is National Volunteer Week, a week to recognize that volunteerism is a building block to a strong and thriving community.  The Drupal Community is no different: as an open-source project our volunteers are vital to the health and growth of our project.  There are so many roles and levels of contribution within our Drupal ecosystem that we at the Drupal Association wanted to highlight how much your contribution means to us and our work.  I took some time and asked around, here’s some of the glowing praise our staff has to say about our phenomenal volunteers. 

“I am continually impressed with the volunteers that I get to work with.  Not only do they rock at their jobs, but they are so dedicated to the work that they do for Drupal and the Cons specifically!  Anyone who has volunteered for a Con knows that it is a large undertaking, and a responsibility that isn't taken lightly. These volunteers come back each week with positive attitudes, valuable ideas and great results.  Although I have only been at the Association for a little over six months, I can truly say that these volunteers are what gives our Cons the 'special sauce' and I am lucky to get to work with volunteers from around the globe on a daily basis.” 

- Amanda Gosner, DrupalCon Coordinator

“Most of my day is spent with Drupal Association staff, who have the luxury of getting paid to think about Drupal for 8 hours a day. A good chunk of my job is working with volunteers though-- the Board of Directors, Drupal.org Working Groups, Community Organizers, DrupalCon session speakers. So many of you give so much of your time and your smarts back to the project and the community, and it's my privilege and duty to learn from you all.”

- Holly Ross, Executive Director

"I look forward to working working with community volunteers to help build and improve Drupal.org. The site would not be where it is today without everyone's work."

- Neil Drumm, Drupal.org Lead Architect

 

“I want to thank Cathy and Jared for being my sprint mentor at DrupalCon Latin America. I made my first comment on the issue queue. It felt so good to cross into that world finally, even if it is was just a baby toe crossing over.”

- Megan Sanicki, COO

 

“It feels like I’m hearing news every day about the amazing programs our community members put together all over the world — from Los Angeles to Uganda and beyond. Without help from amazing community volunteers who donate time working on social media, in the issue queues, or even volunteers who take a brief moment to drop a note in my inbox (“have you seen this?”), these stories would never be shared with our wider community.” 

- Leigh Carver, Content Writer

Today, we invite you to take a few minutes to recognize your fellow Drupal contributors by tweeting or sending a message via IRC to appreciate each other.  After all, without our volunteers, our Drupal Community would not be as lively, bright, and welcoming.  Want to lend a hand?  Our get involved page has plenty of ways to volunteer with the project.

Categories: Drupal
Syndicate content


Google+
about seo