Planet Drupal

Syndicate content - aggregated feeds in category Planet Drupal
Updated: 1 day 21 hours ago

Drupal Watchdog: Drupal People

Tue, 2015-04-21 12:39

Drupal people are good people. They are the recipe’s secret ingredient, and conferences are the oven. Mix and bake.

March 2007, Sunnyvale, California, the Yahoo campus and a Sheraton.

OSCMS, my second Drupal event and my first conference.

Dries gave the State of Drupal keynote, with a survey of developers and a vision for future work. His hair was still a bit punk and he was a bit younger. Dries has the best slides. Where does he find those amazing slides?

I like Dries a lot.

I wish I had created Drupal.

In 1999, I created my own CMS named Frameworks. I remember showing my friend Norm an "edit" link for changing text and how cool that was. Back then, I didn't even know about Open Source – despite being a fanboy of Richard Stallman and the FSF – and I was still using a mix of C/C++, Perl, and IIS. (If you wanted to eat in the 1990's, Windows was an occupational hazard.)

But I didn't create Drupal. I didn't have the hair, I've never had those amazing slides, and I will never be able to present that well.

But mainly, I didn't have the vision.

Rasmus Lerdorf gave a talk on the history of PHP. I was good with computer languages. I had written a compiler in college, developed my first interpretive language in the late 1980's and another one in the early 1990's. I wondered why I hadn't created PHP. At the time, most web apps were written in Perl. I loved Perl. It was so concise. It was much better than AWK, which in itself was also pretty awesome.

(Note: AWK does not stand for awkward. It’s named after Aho, Weinberger, and Kernighan – of K&R fame).

So I didn't see the need for PHP, we had Perl!

Again, no vision.

Meanwhile: 2007, Sunnyvale, California, OSCMS.

Categories: FLOSS Project Planets

ERPAL: 6 rules to follow to promote communication in projects

Tue, 2015-04-21 09:26

In the last part of our blog series, we dealt with the specifications of a project. Today we discuss the issue of responsibilities and ongoing communication. Ensure that the infrastructure exists to support project communication and that everyone has access to it – and uses it! Keep up the communication in the project and make sure that there’s a central communication tool, especially if you’re working in distributed teams. Define which communications are task-related and should be persisted on the task. This is mostly about teamwork: there’s nothing more damaging to a project than the stagnation of communication after a certain length of the project time, because then everyone in the project team makes different assumptions, leading into different directions. Recurring meetings, such as dailies and weeklies, help to build a culture of ongoing communication.

In addition to the above, also note the following as important points to take into account:

1) Provide a contact person Project work is teamwork. Both suppliers and customers need to meet their obligations in the project. One of the key things is the obligation to cooperate in making decisions. In particular, this includes the acceptance of partial results or the overall project. To make such decisions, a person needs the skills to take this decision and the authority to do so. If there is no clear contact person who’s responsible for all decision areas – financially, professionally and organizationally – the process may stagnate. This can delay the whole project and applies to both sides, vendors and customers alike. 2) What might happen if this contact person doesn’t exist (from the perspective of customer)? Everyone has something to say. The change requests will be considered by all project participants, but remember that only one of them gets the bill at the end of the day. Naturally, the customer may wonder about the amount, but no one ever wants to be responsible. Maybe the wishes were contradictory and mutually canceled each other out in the progression of things, but now, of course, one individual is surprised that – wouldn’t you know – exactly HIS wishes were swallowed up by the ominous “project monster”! This role is usually awarded to the responsible project manager, who in turn must prove that he’s only done what was required. 3) And what can happen from the perspective of the provider? During the project, customer requirements are discussed with various people. If these requirement changes don’t end up in a pot and if reviews are always subjective, it can lead to unwanted side effects. Example: Contact A builds a new forum feature. Person B says: "We’ll delete the forum" while Person C is under the belief that everything is ready and, hence, plans to start the acceptance process.   4) Emphasize all duties right from the beginning As a provider you and your customers should be clear on what obligations each respective party has. Ensure that the project is clear through transparent project management. Don’t drop tasks and always record decisions so that, later, you can see how they were made and how they’ve influenced the overall project. 5) Communicate problems early Of course, it can also come to additional expenses or delays in the project. Make sure that you identify these problems early and communicate them throughout the responsible team. If problems are addressed and resolved constructively in your project culture, as opposed to having long debates about who’s to blame for the problem, even large hurdles can be overcome together. 6) It’s no shame to question things, so ask often! If there are any questions in the project – and there will be – ask them! Anyone who’s too afraid or lazy to ask when there are ambiguities does harm to the project. Assumptions and certainties contradict every form of transparent communication. So provide the team with a centralized and transparent communication (a chat isn’t sufficient as it doesn’t persit the communication). Also, ensure that information and agreements actually make it to the people who need to have access to it. In the next part of our series, we’ll focus on unrealistic budgets and deadlines.
Categories: FLOSS Project Planets

Drupalize.Me: Learning To Debug: Stop Making Assumptions

Tue, 2015-04-21 09:10

Here's an example of an assumption; The sun will rise tomorrow. An assumption is something that is accepted as true or as certain to happen, without proof. This kind of thinking, while convenient, is prone to concealing facts, and troublesome when debugging code. This article defines what an assumption is, and provides some techniques for helping to eliminate them during debugging.

Categories: FLOSS Project Planets

Triquanta Web Solutions: Going Dutch: stemming in Apache Solr

Tue, 2015-04-21 02:14

So, stemming, what is stemming? Generally speaking, stemming is finding the basic form of a word. For example, in the sentence "he walks" the verb is inflicted by adding a "s" to it. In this case the stem is "walk" which, in English, also happens to be the infinitive of the verb.

We will first present a few examples of stemming in natural language, and since Dutch is my native language I will concentrate on Dutch examples.

After that we will show the results of a number of stemmers present in Solr and give a few pointers about what to do if the results of these stemmers are not good enough for your application.


On of the things you absolutely want your user to be able to, is to find results which contain the single form of a word while searching for the plural and vice versa, e.g.: finding "cat" when looking for "cats" and finding "cats" when searching for "cat".

Although in English there are well-defined rules for creating the plural form (suffix with "s", "es" or change "y" to "ie" and suffix "s"), there also are a number of irregular nouns ("woman" -> "women") and nouns for which the single and plural form are the same ("sheep", "fish").

In Dutch more or less the same situation exists, be it with different suffixes ("s", "'s", "en") and, of course, other exceptions.

Furthermore, in Dutch if the stem ends on a consonant directly preceded by a vowel, this consonant is doubled (otherwise, in the plural form, the vowel would sound like a long vowel instead of a short vowel), e.g.:

kat (cat) -> katten (cats)

But, to this rule there also are exceptions, like

monnik (monk) -> monniken (monks)

in contrasts with:

krik (car jack)-> krikken (car jacks) Verb conjugation

Conjugation of verbs in Dutch is, to be blunt, a bit of a mess.

In Dutch, for forming the past tense of a verb, two types of conjugation co-exist: the (pre-) medieval system, now called strong and the more recent system, called weak. When I say the systems co-exist, one should note that most (native) Dutch speakers are not aware of the fact that the strong-system is a system at all: the they consider the strong verbs to be exceptions, best learned by heart.

An example of a strong verb is "lopen" (to walk):

hij loopt (he walks) -> hij liep (he walked)

While an example of a weak verb is "rennen" (to run):

hij rent (he runs) -> hij rende (he ran)

These examples make clear that determening which verb is strong and which verb weak is indeed a case of learning by heart.

Furthermore the change from strong to weak verbs is a ongoing process. One exampe of a verb which is currently in transition from strong to weak is the verb "graven" (to dig) of which both the form "hij groef" (he digged) and "hij graafde" can also be found, although most language-purist would consider the last form as "wrong".

NB: if you are interested in this kind of things, a classic book about language changes is Jean Aitchisons Language change: progress or decay (1981, yes, it is a bit pre-internet...)


In a number of languages, like Dutch, German, Polish and many more, diminutives are created by inflicting the word. In English you form the diminutive by adding an adjective like 'little', but in Dutch the general rule to form a diminutive is to add the suffix "je" to the word, e.g.:

huis (house) -> huisje (little house)

This is the general rule, because the suffix can als be inflicted, like in

bloem (flower) -> bloempje (little flower)

And in some words te ending consonant is changed to keep the word pronouncable:

hemd (shirt) -> hempje (little shirt)

It is however also possible in Dutch to use an adjective like 'klein' (little) and even to combine both:

kleine bloem (little flower) -> klein bloempje (small little flower)

A last peculiarity I should mention is that in Dutch (but also in many other languages) there are words which only have a diminutive form, like 'meisje' (girl).

Homographs and homonyms

For some words it is not possible to find the correct stemming without knowing the semantics or context, e.g. kantelen which if pronounced like kantélen means "battlements" but when pronounced kántelen means "tip over". Or zij kust ("she kisses") versus kust like in de Noordzeekust ("the North sea coast").

Why bother?

So maybe by now you are asking yourself: why bother? Well, you should be bothered because stemming will make it easier for the visitors of your site to find what they are looking for.

For example, you can almost be sure that when a visitor is interested in articles about houses (in Dutch 'huizen'), he will also be interested in articles which mention a house ('huis').

So when using the search term 'huizen' it would be nice if results which contain 'huis' would automatically be shown.

Of course searching a verb is much less common, and the chance that a visitor will use the dimunitive is also not very great, but still it happens and if it takes only a minimal effort to make sure the visitor finds what he is searching for, then why not?


Starting form Solr version 3.1, for English (and a number of other languages) there is a standard filter "EnglishMinimalStemFilterFactory" which has the ability to stem English words. For Dutch however, such a simple filter factory is not available.

There are however a number of default languages that can be used with the SnowballPorterFilterFactory and in the default schema included in Solr 5 a number of such fields are predefined.

Solr 5 default schema

In Solr 5 the default schema defines a list of language specific fieldtypes. For Dutch the fieldtype 'text_nl' is defined as follows:

<dynamicField name="*_txt_nl" type="text_nl" indexed="true" stored="true"/> <fieldType name="text_nl" class="solr.TextField" positionIncrementGap="100"> <analyzer> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_nl.txt" format="snowball" /> <filter class="solr.StemmerOverrideFilterFactory" dictionary="lang/stemdict_nl.txt" ignoreCase="false"/> <filter class="solr.SnowballPorterFilterFactory" language="Dutch"/> </analyzer> </fieldType>

So in short, in the SnowballPorterFilterFactory the language is set to Dutch.

There is however a alternative stemming algorithm avilable, the Kraaij-Pohlmann algorithm, see Porter’s stemming algorithm for Dutch, known in Solr as Kp

To compare both algorithms, we define a new Dutch fieldtype as follows:

<dynamicField name="*_txt_nlkp" type="text_nlkp" indexed="true" stored="true"/> <fieldType name="text_nlkp" class="solr.TextField" positionIncrementGap="100"> <analyzer> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_nl.txt" format="snowball" /> <filter class="solr.StemmerOverrideFilterFactory" dictionary="lang/stemdict_nl.txt" ignoreCase="false"/> <filter class="solr.SnowballPorterFilterFactory" language="Kp"/> </analyzer> </fieldType>

To complete our analysis we will also use the default English language field, defined as:

<dynamicField name="*_txt_en" type="text_en" indexed="true" stored="true"/> <fieldType name="text_en" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt" /> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.EnglishPossessiveFilterFactory"/> <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/> <filter class="solr.PorterStemFilterFactory"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt" /> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.EnglishPossessiveFilterFactory"/> <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/> <filter class="solr.PorterStemFilterFactory"/> </analyzer> </fieldType> Comparison

In the data shown next we compare the three above defined fields with the correct values.

Fieldtype text_en Input katten monniken meisje hempje krikken huizen huisje bloempje loopt Output katten monniken meisj hempj krikken huizen huisj bloempj loopt   Input liep lopen rent rende rennen kust kussen kantelen Output liep lopen rent rend rennen kust kussen kantel   Fieldtype text_nl (language = dutch) Input katten monniken meisje hempje krikken huizen huisje bloempje loopt Output kat monnik meisj hempj krik huiz huisj bloempj loopt   Input liep lopen rent rende rennen kust kussen kantelen   Output liep lop rent rend renn kust kuss kantel     Fieldtype text_nlkp (language = kp) Input katten monniken meisje hempje krikken huizen huisje bloempje loopt Output kat monnik meis hem krik huis huis bloem loop   Input liep lopen rent rende rennen kust kussen kantelen   Output liep loop rent rend ren kust kus kantel     Correct values Input katten monniken meisje hempje krikken huizen huisje bloempje loopt Output kat monnik meisje hemd krik huis huis bloem loop   Input liep lopen rent rende rennen kust kussen kantelen Output loop loop ren ren ren kus (verb)
kust (noun) kus kantel (verb)
kanteel (noun)

The most noticable conclusion of above comparison is that the output of the text_nl-field does not differ much from the text_en-field.

It seems that the 'Dutch'-language implementation of the SnowballPorterFilter has no way of stemmming dimunitives, results like "huisj" and "bloempj" are just plain wrong, while the Kraaij-Pohlmann correctly returns "huis" en "bloem".

The same holds for the plural "huizen" which is correclty stemt by Kraaij-Pohlmann to "huis".

The dimunitive "meisje" is stemt by Kraaij-Pohlmann to "meis" which in some dialects of Dutch, like the dialect spoken in De Zaanstreek, is actually correct. There is however a way to correct this, see the section about KeywordMarkerFilterFactory under "a bit disappointed?".

And "hempje" is wrongly stemt to "hem", which seems a too general application of the rule which correctly stems "bloempje" to "bloem"

None of the algorithms knows how to handle homographs like "kust" and "kantelen" but this was to expected.

A bit disappointed?

Well, maybe your expectations were a bit high then... Natural language processing is notoriously hard and, for that part that requires background knowledge, as good as impossible when working on single words or short phrases.

But in general the Kraaij-Pohlmann algorithm does a rather good job stemming Dutch words. Sometimes however, like with the word "meisje" it is a bit over-enthusiastic.

But there are a number of ways to improve stemming if, for some reason, the results of Kraaij-Pohlmann algorithms are not good enough.


The KeywordMarkerFilter makes it possible to exclude words from a (UTF-8) text file from stemming. A word like "meisje" would be a good candidate for this. To use it, add a filter to your fieldtype like this:

<filter class="solr.KeywordMarkerFilterFactory" protected="notStemmed.txt" />

The file "notStemmed.txt" should be in the same directory as the schema.xml.


The StemmerOverrideFilterFactory is a variation on the KeywordMarkerFilterFactory filter, but instead only saying "do not stem these words" you must provide a file which defines the stemming for given words. To use it, add a filter to the field type like this:

<filter class="solr.StemmerOverrideFilterFactory" dictionary="dictionary.txt" ignoreCase="true"/>

and make sure the file "dictionary.txt" is present in the conf-directory. In this file (which, like all others has to be encoded UTF-8) you add 1 ine per word, each lne consisting of the word an the stemmed word seperated by 1 tab, like this:

hempje hemd

Both KeywordMarkerFilterFactory and StemmerOverrideFilterFactory should be used as addition to the default stemming,


Hunspell is the open source spellchecker used in a number of open source projects like LibreOffice, Mozilla Thunderbird etc.

It is possible to use Hunspell if it supports your language. To do so add a filter to the fieltype like this:

<filter class="solr.HunspellStemFilterFactory" dictionary="nl_NL.dic" affix="nl_NL.aff" ignoreCase="true" />

And make sure the files "nl_NL.dic" and "nl_NL.aff" are present in the conf-directory.

Creating your own stemming algorithm

Of course if you are really ambitious you can start from scratch and write your own Snowball implementation, from the Snwoball website:

Snowball is a language in which stemming algorithms can be easily represented. The Snowball compiler translates a Snowball script (a .sbl file) into either a thread-safe ANSI C program or a Java program. For ANSI C, each Snowball script produces a program file and corresponding header file (with .c and .h extensions). The language has a full manual, and the various stemming scripts act as example programs.

But be warned: no natural language or natural language phenomenon is easy to fit in an algorithm and you have to be sure to have all quirks and exceptions absolutely clear before you start.

Links and literature
Categories: FLOSS Project Planets

Jim Birch: Drupal 7: Integrating Disqus Comments

Mon, 2015-04-20 16:04

When choosing whether or not to have commenting on your site, one of the factors that I always discuss with clients is whether or not the site has a need for logged in users.  If the site has users who log in, Drupal core's commenting system is great and can be tweaked to fit pretty much every need.

If users don't need to have users log in, there are a few solutions for "outsourcing" your comment system

  • Using an external commenting system has benefits like:
  • better security
  • better/cheaper spam management
  • more full page caching opportunities.

I chose to go with Disqus for this site.  Disqus' social login includes all of the necessary platforms.  If not, people can sign up with an account in a minute.  The design is light, and these days very common.  Their spam detection, and moderation/flagging rules are simple and easy to maintain.

Read more

Categories: FLOSS Project Planets

Drupal Watchdog: VIDEO: DrupalCon Amsterdam Interview: Fabian Franz

Mon, 2015-04-20 14:18

Cruising down the Amstel River on a blissfully warm Amsterdam evening – drink in hand – the fabulous FABIAN FRANZ (Senior Performance Engineer & Technical Lead, Tag1 Consulting) opens up about DrupalCons, chance encounters, caching, salsa dancing, love, and what to listen to when you’re programming.

Tags:  Video DrupalCon DrupalCon Amsterdam Video: 
Categories: FLOSS Project Planets

Drupal for Government: Path aliased restful services with restws & restws alias

Mon, 2015-04-20 13:23

Almost a year ago we started putting together a site that needed to integrate with our main librarie's search engine.  We used Drupal's restful services to expose our content, but ran in to a problem with getting aliased paths to link up correctly.  What this meant was that while worked fine, didn't... this became really problematic when we were trying to create linked data, and traversing was just obnoxious... just doesn't roll off the digital tongue... as a workaround we used views to do some wonkiness.... it worked, but certainly was not "the drupal way."

Categories: FLOSS Project Planets

SitePoint PHP Drupal: Drupal goes Social: Building a “Liking” Module in Drupal

Mon, 2015-04-20 12:00

In this article, we are going to look at how we can create a Drupal module which will allow your users to like your posts. The implementation will use jQuery to make AJAX calls and save this data asynchronously.

Creating your Drupal like module

Let’s start by creating the new Drupal module. To do that we should first create a folder called likepost in the sites\all\modules\custom directory of your Drupal installation as shown below:

Inside this folder, you should create a file called with the following contents:

name = likepost description = This module allows the user to like posts in Drupal. core = 7.x

This file is responsible for providing metadata about your module. This allows Drupal to detect and load its contents.

Continue reading %Drupal goes Social: Building a “Liking” Module in Drupal%

Categories: FLOSS Project Planets

Drupal Association News: A great big thank you to our Members

Mon, 2015-04-20 11:50

I want to give a big thank you to all of our new and renewing members who gave funds to continue the work of the Drupal Association in the first quarter of this year. We couldn't do much without your support. Shout outs to all of you!

Membership Makes a Difference

We had several recap blog posts a few weeks ago, but just as a reminder, your membership is incredibly important not only to us, but to the project too! Dues from memberships go to fund intiaitves like our community cultivation grants, which help people around the world build their local Drupal communities and improve the project. For more information on how membership makes a difference, check out this infographic or see what changes are coming in 2015.

Thank You, Members!!

There are 845 fantastic members on our list of first quarter donors. You can find the list here. Let's give them a big thank you all together!


Personal blog tags: Membership
Categories: FLOSS Project Planets

Drupal Association News: Blink Reaction and Propeople Are Joining Forces

Mon, 2015-04-20 10:27

The following blog was written by Drupal Association Supporting Partner and DrupalCon Los Angeles Diamond Sponsor Blink Reaction and Propeople.

DrupalCons are a very important time of the year for the Drupal community. It is a time for us to come together and continue our collaboration that we share throughout the year in a virtual space and establish goals and plans to move forward in a way that is in the community’s best interest. It is also a time to take stock of our accomplishments, and who we are as a community. One of our favorite moments in DrupalCons is the group picture: it’s always amazing to see how the community stands together and continues to grow.

This year’s DrupalCon in Los Angeles is especially important to us because this is where we will unveil the name of the new Drupal agency that consists of the companies formerly known as Blink Reaction and Propeople. We have come together to create a new digital agency, the largest one in the world with a focus on Drupal, and we are very excited about what this means.

Our combined agency is part of the Intellecta Group (listed on the NASDAQ OMX) , and consists of 400+ employees in 19 offices in 11 countries on 4 continents. This is an amazing reach for an organization that is so passionate about Drupal! We’re excited for this unique opportunity to support the Drupal project and the community in ways that would have been impossible prior to the merger.

For example, we’re eager to begin promoting Drupal as a solution for the biggest enterprises on a global scale. Locally, we can influence awareness and excitement in our 19 local communities, helping the next generation find opportunity and excitement in Drupal.

We now have the ability to affect change in a multitude of cultures, in the many diverse communities where each of our offices are located. Where there aren’t yet camps, we can lead their initiation. Where there are Cons, we can help to inspire the next generation of Drupal leaders. We are committed to building up the next generation of talent via our orchestrated public and private training efforts, and look forward to beginning that work at DrupalCon Los Angeles.

So please, stop by booth 300 to say hello and learn more about the new company, and our future within the community. We look forward to seeing all of our friends in the Drupal community, old and new, and are even more excited to discuss how we’ll work with the community for many years to come.

About us.

Blink Reaction and Propeople are joining forces to create a new digital agency built on technology, driven by data, and focused on user experience. The two companies have delivered state-of-the-art Drupal solutions for a variety of the open-source platform’s largest customers. The agencies’ collective portfolio includes brands such as Pfizer, NBC, Stanford University, the City of Copenhagen and General Electric.

Blink Reaction and Propeople are a part of the Intelleca Group. The companies in the group are Blink Reaction LLC, Bysted AB, Bysted A/S, Hilanders AB, Intellecta Corporate AB, ISBIT GAMES AB, Propeople Group ApS, Rewir AB, River Cresco AB, Unreel AB and Wow Events AB. Intellecta AB is noted on NASDAQ OMX Stockholm and employs around 550 people in Sweden, Denmark, Austria, Germany, the Netherlands, the United Kingdom, Bulgaria, Moldavia, Ukraine, Brazil, USA, Vietnam and China.

Categories: FLOSS Project Planets Happy birthday to me and Devel form debug module to you all

Mon, 2015-04-20 08:36
I’m turning 32 today. People love birthdays, to me it’s just another line number in a messed stack trace output (philosophy mode enabled).   Two years ago I released a drupal module called Get form id (deprecated from now on) that does one small task - it tells you any form's id ...

Read now

Categories: FLOSS Project Planets

Annertech: Drupal: Creating Beans Programatically

Mon, 2015-04-20 06:59
Drupal: Creating Beans Programatically

Building great (Drupal) websites can often be made more difficult than it needs to be when your site builders, developers and themers haven't got the same content as each other.

Categories: FLOSS Project Planets

Web Omelette: Drupal 8: core javascript files for anonymous users

Mon, 2015-04-20 03:00

Drupal 8 comes with many performance improvements, one of which being that javascript is no longer indiscriminately loaded on every page. This means that for anonymous users, there are many pages where there is no jQuery or even javascript loaded.

Although this is a good thing, sometime you do need jQuery (for example to use Ajax, in which case you'd also need other scripts). So how do you load these files? Using hook_page_attachments() to #attach your own library to the page.

And if we look at the documentation page for assets, we'll see how we can add our own library. We need to create a my_module.libraries.yml or my_theme.libraries.yml file. And inside, we can add the following:

my_scripts: version: VERSION js: js/scripts.js: {} dependencies: - core/jquery - core/drupal.ajax - core/drupal - core/drupalSettings - core/jquery.once

Where my_scripts will be the name of the library we will reference when attaching.

As you can see, we are not including any javascript or css of our own, we are just making use of the dependency scripts provided by core.

Above, I mentioned the use of hook_page_attachments() as the way we can attach libraries. However, it's not the only one. You can attach to render arrays or even render elements. But here we want to see how we can make sure that anonymous users get the required core javascript files loaded on pages. So we can implement hook_page_attachments() like so:

function my_module_page_attachments(array &$attachments) { // Attach only for anonymous users. if (\Drupal::currentUser()->isAnonymous()) { $attachments ['#attached']['library'][] = 'my_module/my_scripts'; } }

In this hook, we check if the current user is anonymous and attach the library we created. We reference this with the construct module_name/library_name.

Hope this helps.

In Drupal 8 | Theming var switchTo5x = true;stLight.options({"publisher":"dr-8de6c3c4-3462-9715-caaf-ce2c161a50c"});
Categories: FLOSS Project Planets

Vardot: Hello Drupal: Free Training Session at PSUT

Mon, 2015-04-20 02:21

In part of our joint educational initiative with Acquia, we’re back in 2015 with new training sessions at universities to educate students on the benefits and value of Drupal as a leading content management system. Students who are interested in Drupal and open source technologies, have the chance to learn more about Drupal from Vardot and Acquia, and experience first hand, installing and setting up Drupal.

The first event will take place in Princess Sumaya University for Technology (PSUT) on the 29th April 2015 at 12:30 PM. You can learn more about the event on Acquia’s Training Event Page

Tags:  Drupal Planet Drupal Training Acquia Drupal Title:  Hello Drupal: Free Training Session at PSUT
Categories: FLOSS Project Planets

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

Fri, 2015-04-17 15:14
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: FLOSS Project Planets Featured Case Studies: National Baseball Hall of Fame and Museum

Fri, 2015-04-17 14:30
Completed Drupal site or project URL:

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: FLOSS Project Planets

Drupal Watchdog: VIDEO: DrupalCon Amsterdam Interview: Angie Byron

Fri, 2015-04-17 12:59

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: FLOSS Project Planets

Chapter Three: Presentation: Drupal 8 Module Development

Fri, 2015-04-17 12:15

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: FLOSS Project Planets

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

Fri, 2015-04-17 11:27

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: FLOSS Project Planets