Drupal Commerce: Managing D8 module dependencies with the new Composer Manager

Planet Drupal - Fri, 09/01/2015 - 15:06

It's not uncommon for a Drupal module to need an external library in order to function.
Historically, modules such as oauth2_server have done this by asking the end-user to download the library manually and extract it into sites/all/libraries. A hook_requirements() implementation would nag the end-user until the library is found.
Nowadays, all libraries are registered on Packagist and expect to be installed via Composer, which also resolves and downloads their dependencies. Thanks to Composer and modern PHP, the number and usage of libraries has skyrocketed, with Packagist recently counting its 500 millionth package install. Because of this thriving ecosystem, it is now more desirable than ever for modules to depend on libraries instead of reinventing the wheel. Furthermore, it is desirable for modules to release their core logic as libraries, bringing in additional users and contributors from the wider ecosystem.

So, how does Composer work, and why do we need Composer Manager?

Read on for more details...

Categories: Elsewhere

Chris Lamb: Uploading a large number of files to Amazon S3

Planet Debian - Fri, 09/01/2015 - 14:31

I recently had to upload a large number (~1 million) of files to Amazon S3.

My first attempts revolved around s3cmd (and subsequently s4cmd) but both projects seem to based around analysing all the files first, rather than blindly uploading them. This not only requires a large amount of memory, non-trivial experimentation, fiddling and patching is also needed to avoid unnecessary stat(2) calls. I even tried a simple find | xargs -P 5 s3cmd put [..] but I just didn't trust the error handling correctly.

I finally alighted on s3-parallel-put, which worked out well. Here's a brief rundown on how to use it:

  1. First, change to your source directory. This is to ensure that the filenames created in your S3 bucket are not prefixed with the directory structure of your local filesystem — whilst s3-parallel-put has a --prefix option, it is ignored if you pass a fully-qualified source, ie. one starting with a /.
  2. Run with --dry-run --limit=1 and check that the resulting filenames will be correct after all:
$ export AWS_ACCESS_KEY_ID=FIXME $ export AWS_SECRET_ACCESS_KEY=FIXME $ /path/to/bin/s3-parallel-put \ --bucket=my-bucket \ --host=s3.amazonaws.com \ --put=stupid \ --insecure \ --dry-run --limit=1 \ . [..] INFO:s3-parallel-put[putter-21714]:./yadt/profile.Profile/image/circle/807.jpeg -> yadt/profile.Profile/image/circle/807.jpeg [..]
  1. Remove --dry-run --limit=1, and let it roll.
Categories: Elsewhere

LimoenGroen company blog: Automatically generated subdomains in Drupal

Planet Drupal - Fri, 09/01/2015 - 14:21

A few weeks ago the new version of MijnStadMijnDorp.nl was launched to the public. Built by LimoenGroen, it offers a rich media platform where historical societies based in the Dutch province of Overijssel showcase their collections.

One of the project challenges was to emphasize the personalized look and feel of each society within the global site structure; every society has its own homepage with an introduction and a collage of curated content. Subdomains (e.g. subdomain.example.com) helped us achieve this. In this article we discuss what we encountered.

The Subdomain module

The core functionality was established using the contrib module Subdomain. In a nutshell, the Subdomain module can be setup to use a unique subdomain for page callbacks related to a specific user, taxonomy term, organic group or content type.

In the case of MijnStadMijnDorp.nl, we used the organic group mode, as each society is an organic group and needed a subdomain. All content of a society lives within its group and has the subdomain applied to it. By default, the name of the subdomain is either based on the name of the organic group or on end user input. We modified this behavior so the subdomain is set to the name of the organic group (society) by default, but can be manually overridden by users with administrative privileges. This comes in handy for societies with long names where an abbreviated subdomain is more suitable.

Automatically set subdomain after node creation:/** * Implements hook_node_insert(). * * Automatically set subdomain after node creation. */ function my_module_node_insert($node) { switch ($node->type) { case 'society': $node->subdomain = subdomain()->clean($node->title, TRUE); subdomain_url_outbound_cache_clear(); // Create unique subdomain. subdomain()->save_record($node->nid, $node->title, TRUE); break; } } Dnsmasq

During local development, testing dynamically generated subdomains can be cumbersome when using a local hosts file, because wildcards cannot be used. Dnsmasq to the rescue! It is a DNS resolver running as a daemon on a local development machine. Dnsmasq was configured to resolve the DNS zone used for local development (e.g. mijnstadmijndorp.dev) to This also resolves any child zones (subdomains) to localhost. Since we use Apache locally, we had ServerAlias *.mijnstadmijndorp.dev added in the virtual host configuration.

Preparations for deployment

Using dynamically generated subdomains in a production environment typically involves configuring the webserver and the DNS zone for the root domain of the website.

For Apache, adding ServerAlias *.mijnstadmijndorp.nl to the virtual host configuration was sufficient. Similar directives were setup for the other servers in our DTAP-environment, with applicable hostnames.

When using HTTPS (which is always a good idea), serving content from dynamically generated subdomains means you need a wildcard certificate. In our case, a public key certificate with *.mijnstadmijndorp.nl as subject name was used.

For DNS, a wildcard (*.mijnstadmijndorp.nl) A-record was created.

Caveats and considerations

The Subdomain module schema has a textfield for the subdomain value, with a maximum length of 255. RFC 1035 states that the maximum length of a DNS label is 63 characters, and the accumulated length of all labels within a FQDN should not exceed 255 characters. The Subdomain module currently does not check the length of the subdomain DNS label or the accumulated length of the FQDN. This can result in URI’s that do not resolve. We submitted a patch for review that fixes this issue.

In terms of SEO, using subdomains should not negatively affect the ranking of a website as a whole. Google has stated they do not treat subdirectories different from subdomains (source), and as such there should be no penalties or split page rank amongst the subdomains. However, discussions on SEO forums indicate ranking was improved for some users when switching from separated subdomains to one shared hostname with subdirectories (source).

Categories: Elsewhere

Patrick Matthäi: php-redis Wheezy backport

Planet Debian - Fri, 09/01/2015 - 14:17


I have just backported the php-redis (php5-redis) 2.2.5-1~bpo70+1 package for Debian Wheezy. Thanks to the ftp-masters for their quick ACCEPT :)
Now you can install and use the redis PHP extension from the offical repositories, see:

Instructions: http://backports.debian.org/Instructions/
Package: https://packages.debian.org/wheezy-backports/php5-redis

Categories: Elsewhere

groups.drupal.org frontpage posts: Curso online de Experto en Drupal 7. Pruébalo gratis!!

Planet Drupal - Fri, 09/01/2015 - 13:42

A qué esperas para unirte al curso más completo de Drupal 7? Si tienes dudas, ahora puedes probarlo gratis durante una semana!

Y si quieres continuar con el curso completo, tendrás un 10% de descuento aplicando el cupón CURSOS10.

El curso de Experto en Drupal 7 incluye Site Building y Development y se compone de 60 unidades en 3 niveles: Inicial, Intermedio y Avanzado. Después de completar los tres módulos tendrás que desarrollar un Proyecto Final. La duración total del curso es de 7 meses con 420 horas certificadas, pero puedes acortar este tiempo con mayor esfuerzo y dedicación.

Aunque esta acción formativa requiere un esfuerzo importante, ahorrarás mucho tiempo en comparación con estudiar Drupal por tu cuenta, sin dejarte nada en el camino y ganando muy pronto en solvencia para afrontar cualquier proyecto en Drupal.

Ten cuidado, si lo pruebas querrás continuar!


Categories: Elsewhere

Amazee Labs: Zurich joins the Drupal Global Sprint Weekend 2015

Planet Drupal - Fri, 09/01/2015 - 13:35
Zurich joins the Drupal Global Sprint Weekend 2015

On the weekend of 17. & 18.01.2015, dozens of Drupal contribution sprints will be taking place across the globe. Amazee Labs invites all of you interested in learning, hacking and improving Drupal to join us for two days of pure sprinting at our offices in Zurich.

  • Date: 17. & 18.01.2015
  • Time: 9:00 a.m. - open end
  • Location: Amazee Labs, Förrlibuckstrasse 30, 8005 Zürich
  • Food & Drink: provided
  • Registration: RSVP here

What can I expect from sprinting with you?

  • Get up to speed with the Drupal 8 and dive into coding new patterns
  • See how far you can get with the much improved site building tools in Drupal 8
  • Submit your first Drupal patch as a contributor
  • Help out in a Drupal core initiative
  • Discuss hard problems face-to-face with other experienced Drupalistas
  • A sprint place with enough food and drinks to get things done
  • Be your own client and have fun :)

Who can contribute?

Coders, designers, front-end developers, designers, project managers, user experience experts, clients, basically anyone who wants to improve Drupal, are welcome to the sprints.

Regardless of your knowledge level, if you have built a site in Drupal, you can contribute and are warmly welcomed.

What can I work on?

We will split into groups and work on Drupal core issues. Bring your laptop. For new folks: you can get a head start also by making an account on Drupal.org, setting up your dev environment (https://www.drupal.org/dev-env) and developers can install git before coming and git clone Drupal 8 core.

A great way to get started with contributing to Drupal core is to get involved with an initiative. We'll have local folks present with knowledge about Multilingual, Rules, CMI etc. Also check out the Drupal core initiatives and topics!

The following sprint topics have been proposed already:

Registration: RSVP here

Categories: Elsewhere

Drupal core announcements: Changes to Drupal 8 that affect admin theme maintainers

Planet Drupal - Fri, 09/01/2015 - 13:01

Happy Friday! I maintain the admin theme in Drupal 8 core: Seven. There have been many changes to Seven in Drupal 8 that affect the relationship between admin themes and modules, and how the admin UI is generated.

I've always thought that the strategy we've put in place are going to have a positive impact on maintainers of contrib admin themes, but I've never sought out feedback directly. I am now!

Object oriented CSS

We now have CSS standards in Drupal 8. All CSS in core is being rewritten and restructured inline with those standards. They are heavily influencds by the principles of OOCSS, SMACSS, BEM, and the writings of Nicolas Gallagher.

The Seven theme, with the introduction and evolution of the Seven Style Guide, embraced these principles from design down to implementation. As all modules with administrative UIs are tested against Seven, the architecture and design of Seven influences all contrib admin themes.

Reusable admin CSS components

Taking influence from frontend frameworks such as Bootstrap, Seven's design is now split into components, instead of per page overrides and designs.

This creates a 'visual api' of sorts that modules hook into and reuse to create the admin UI they need without having to write any CSS. It also ensures a greater consistency throughout Drupal's UX.

One common example are buttons, the classes .button, .button--primary, .button--danger, .buttoner--small can be applied to any element.

Another is the heading classes. Classes like .heading-a, .heading-b, heading-c</code mimic the hierarchy of the <code>h1, h2, h3 elements. You can pick the font sizes that look right for your page without affecting accessibility or overriding it in CSS.

We also have reusable classes to control layout. Using classes like .layout-column.half, .layout-column.quarter, .layout-column.three-quarter will layout your page for you. Classes such as .leader, .leader-double, .leader-triple will add spacing above an element that matches the base leading of Seven, while .trailer, .trailer-double, .trailer-triple will add spacing below.

Another low level component are the color classes, .color-success, .color-warning, .color-error allow you to reuse colors defined in the Seven styleguide, without a tool like Sass or CSS variables.

Less admin CSS in modules

With a full library of reusable CSS components, contrib modules will need to write less CSS. From my point of view, this is a big win for contrib admin theme maintainers, who have to write a lot of custom CSS to override custom CSS in some complex modules, and it's harder to tell if modules are broken because of the changes in the admin theme.

I'm hoping that admin theme maintainers will be able to override just the reusable components and have better coverage of core and contrib modules.

Ongoing work

We are still working on converting a lot of custom CSS into reusable components, and will continue to build the library of components after Drupal 8s release.

Feedback please!

Admin theme maintainers, are there any problems or pitfalls you see with this approach? I would like to know.

Categories: Elsewhere

Appnovation Technologies: How to add JS and CSS assets to a Drupal 8 theme

Planet Drupal - Fri, 09/01/2015 - 08:21

In one of my previous posts I wrote about creating a Drupal 8 theme and declaring assets (JS and CSS) associated with it.

var switchTo5x = false;stLight.options({"publisher":"dr-75626d0b-d9b4-2fdb-6d29-1a20f61d683"});
Categories: Elsewhere

LevelTen Interactive: Drupal 8 Videos You Need To Watch

Planet Drupal - Fri, 09/01/2015 - 07:00

I searched far and wide to bring you great Drupal 8 presentations. These videos provide great examples of where Drupal is headed, why change is important and what you can expect from Drupal 8 and beyond.

... Read more

Categories: Elsewhere

Akshay Kalose: Drupal 8: RDF UI (Schema.org Mappings)

Planet Drupal - Fri, 09/01/2015 - 06:29

RDF UI is a module for Drupal 8 created by Sachini Aparna Herath for her Google Summer of Code 2014 project. RDF stands for Resource Description Framework; it provides a standardized model for data interchange. This module enables you to easily create mappings of Schema.org Things to Drupal Content Types and Fields. RDF UI will embed these specified mappings in the HTML as RDFa once your content is published. This blog post was made for Google Code-In 2014 to test and review RDF UI.


RDF UI can be easily installed using the Drush command line tool for Drupal. You may want to select installing the development version, as that will be the closest to running with the latest Drupal 8 development version:

drush dl rdfui --select


This section is about my experience upgrading RDF UI to the latest Drupal 8. This module was created over the summer, when GSoC takes place. As a result, it wasn’t compatible with the latest Drupal 8 development release, Beta 4.

I started upgrading from the stable version, and by the time I realized there was a development version, I had already done much of the upgrading, so I integrated the changes from that branch into my upgrade while still keeping most of mine similar to how it was before.

Some of the things I had to upgrade were: moving the attached CSS to a library, re-factoring the Form State from an array to an object, and accounting for the fact that Drupal\views_ui\OverviewBase was merged into Drupal\views_ui\DisplayOverviewBase. I also have included minor improvements here and there in the code.

One problem I encountered while using the sub module was that the default Schema.org/Text Data Type was text. However in the latest Drupal 8, this is the formatted text, and the plain text was needed, so this was fixed by changing the default from “text” to “string“:

diff --git a/rdf_builder/src/Form/ContentBuilderForm.php b/rdf_builder/src/Form/ContentBuilderForm.php index 6d2001a..c3cc50c 100644 --- a/rdf_builder/src/Form/ContentBuilderForm.php +++ b/rdf_builder/src/Form/ContentBuilderForm.php @@ -64,8 +64,8 @@ class ContentBuilderForm extends FormBase { public function __construct() { $this->converter = new SchemaOrgConverter(); $this->datatype_field_mappings = array( - 'http://schema.org/Text' => 'text', - 'http://schema.org/PostalAddress' => 'text_long', + 'http://schema.org/Text' => 'string', + 'http://schema.org/PostalAddress' => 'string_long', 'http://schema.org/Number' => 'integer', 'http://schema.org/MediaObject' => 'file', 'http://schema.org/AudioObject' => 'file', @@ -470,6 +468,6 @@ class ContentBuilderForm extends FormBase { return $this->datatype_field_mappings[$datatype]; } } - return 'text'; + return 'string'; } }

The full upgrade patch can be viewed at this Issue on RDF UI.


As said on the project page, integration of Schema.org mappings in Content Types is seamless. In the “Add Content Type” form you can choose which Schema.org Type this Content Type will be:

Once you fill this out and reach the “Manage Fields” page, you need to create you new fields. You can then click the “RDF Mappings” tab to assign these fields their Schema.org property:

Now you are ready to go ahead and create your content. Once created and published, the node should show the fields and the html should contain the Schema.org Type in the article tag and Schema.org Properties in the field-items divisions:

RDF UI Builder!

RDF UI also comes with a very helpful sub module named: RDF UI Builder. Want to shorten up all the steps above in creating Schema.org mapped Content Types? This sub module comes in handy for that very purpose.

Once this module is enabled, you can find the new “+ Add Schema.org Content Type” button next to the original “+ Add content type” button:

After selecting which Schema.org Type you want to use, you are redirected to the next page where the only thing you need to do is select which fields you want, and they will automatically be created and mapped for you!

That’s it, now you can go off and create content for that type.


Sachini Aparna Herath, with the help of her mentors Stéphane Corlosquet and Kevin Oleary, has created a great module for Drupal 8. RDF UI fits in with the rest of Drupal, and can be used to quickly create content types or fields and assign them Schema.org Types and Properties. This can help any site owner to provide “semantic rich data” on their web pages.

One improvement I can suggest is that the http://schema.org/Date Type should default as date only in Drupal. As of right now both http://schema.org/DateTime and http://schema.org/Date convert into Drupal datetime. This may be because Drupal does not have Date and DateTime options in the drop down. If this is the case, this improvement would be for Drupal Core to move selecting DateTime or only Date to the main select menu before selecting Date and then choosing for a new field.

From a Google Code-In perspective, this task had many obstacles which I had to go through to upgrade the module to be working with the latest Drupal 8 version, Beta 4, and I am glad as I keep learning more with the more problems I face. It is also the first time I have created a change record, because one of the errors received had not been included in the list of changes.

The post Drupal 8: RDF UI (Schema.org Mappings) appeared first on Akshay Kalose.

Categories: Elsewhere

Károly Négyesi: static methods

Planet Drupal - Fri, 09/01/2015 - 06:27

Here's something I learned from Wim Leers: the static keyword has a bad rep in PHP but that's because static variables can be problematic. static methods, especially protected static methods on the other hand are useful to indicate and enforce a method not changing the state of the object.

Categories: Elsewhere

Dirk Eddelbuettel: random 0.2.3

Planet Debian - Fri, 09/01/2015 - 03:50

A new release of my random package for truly (hardware-based) random numbers as provided by random.org is now on CRAN.

The main change is a switch to the curl() function from the eponymous package by Jeroen Ooms. This was caused by random.org now using https instead of http, annd the fact that te url() function from R does not cope well with the redirect. Besides this (enforced) change, everything else remains the same.

Courtesy of CRANberries comes a diffstat report for this release. Current and previous releases are available here as well as on CRAN.

This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.

Categories: Elsewhere

Peter Eisentraut: Directing output to multiple files with zsh

Planet Debian - Fri, 09/01/2015 - 02:00

Normally, this doesn’t work as one might naively expect:

program > firstfile > secondfile

The second redirection will override the first one. You’d have to use an external tool to make this work, maybe something like:

program | tee firstfile secondfile

But with zsh, this type of thing actually works. It will duplicate the output and write it to multiple files.

This feature also works with a combination of redirections and pipes. For example

ls > foo | grep bar

will write the complete directory listing into file foo and print out files matching bar to the terminal.

That’s great, but this feature pops up in unexpected places.

I have a shell function that checks whether a given command produces any output on stderr:

! myprog "$arg" 2>&1 >/dev/null | grep .

The effect of this is:

  • If no stderr is produced, the exit code is 0.
  • If stderr is produced, the exit code is 1 and the stderr is shown.

(Note the ordering of 2>&1 >/dev/null to redirect stderr to stdout and silence the original stdout, as opposed to the more common incantation of >/dev/null 2>&1, which silences both stderr and stdout.)

The reason for this is that myprog has a bug that causes it to print errors but not produce a proper exit status in some cases.

Now how will my little shell function snippet behave under zsh? Well, it’s quite confusing at first, but the following happens. If there is stderr output, then only stderr is printed. If there is no stderr output, then stdout is passed through instead. But that’s not what I wanted.

This can be reproduced simply:

ls --bogus 2>&1 >/dev/null | grep .

prints an error message, as expected, but

ls 2>&1 >/dev/null | grep .

prints a directory listing. That’s because zsh redirects stdout to both /dev/null and the pipe, which makes the redirection to /dev/null pointless.

Note that in bash, the second command prints nothing.

This behavior can be changed by turning off the MULTIOS option (see zshmisc man page), and my first instinct was to do that, but options are not lexically scoped (I think), so this would break again if the option was somehow changed somewhere else. Also, I think I kind of like that option for interactive use.

My workaround is to use a subshell:

! ( myprog "$arg" 2>&1 >/dev/null ) | grep .

The long-term fix will probably be to write an external shell script in bash or plain POSIX shell.

Categories: Elsewhere

Forum One: Forum One to Host Global Sprint Weekend in DC

Planet Drupal - Thu, 08/01/2015 - 23:49

Want to join me for a marathon next weekend?

As part of a worldwide effort known as the Drupal Global Sprint Weekend, hundreds of coders from around the world are joining together in a united effort to complete a marathon task: the launch of the next generation of the world’s most popular open-source platform, Drupal 8.

To participate in this massive movement and contribute to the Drupal Community, Forum One is hosting a local Code Sprint in downtown Washington, DC on Saturday, January 17th. Sign up here »

Never been to a code sprint before? No worries; we’re pros at these events! Here’s what you can expect:

What is a code sprint?

A code sprint is when developers get together and write code. There’s minor instruction and some ad hoc mentoring, but mainly the focus is just uniting developers and hammering out code together. That’s all there is to it!

How will this event work?

Our developers will work with you to find Drupal 8 core issues for you to focus on. You won’t need to research anything on your own, but you will need to bring your own laptop, and it helps a lot if you set up your development environment beforehand. For instructions on how to get set up and for additional details like the event agenda, visit the RSVP page »

Why should I attend?
  • You’ll meet other DC area developers!
  • You’ll roll up your sleeves and become a bona fide Drupal 8 Core Contributor!
  • You’ll learn from our on-site mentors and fellow developers!
  • You’ll earn tons of karma by furthering the mission of the open-source development model!
  • It’s totally free!

Intrigued? Excited? Can’t hardly contain your enthusiasm? Awesome! Sign up for this free event and join me and the DC open-source developer community as we take on this marathon effort and get 26.2-ish miles closer to bringing Drupal 8 across the finish line.

Categories: Elsewhere

Mediacurrent: How to prettify the output from your remote drush commands

Planet Drupal - Thu, 08/01/2015 - 22:55

Have you noticed how the output from your remote drush commands wraps at awkward lengths? This is especially annoying with features commands:

Well, here's a quick fix! Throw this snippet into your drush alias. It adds a "shell-alias" that executes the features-list command with the --tty SSH option.

Categories: Elsewhere

DrupalOnWindows: Installing Drupal on Windows and SQL Server

Planet Drupal - Thu, 08/01/2015 - 20:13

This article explains how to install Drupal on IIS and SQL Server with the basic performance settings. It is aimed at understading the different pieces that compose the environment needed to run Drupal on Windows and intended to audiences that have at least an intermediate level of confidence with Windows, IIS and SQL Server.

Language English
Categories: Elsewhere

Drupal Easy: Nimble Training

Planet Drupal - Thu, 08/01/2015 - 18:36

Since we have ramped up our training business over the past months, I've been teaching a lot of Drupal to a lot of different types of people with various backgrounds, goals and motivations. As diverse as they may be, from private client training engagements for some of the largest Drupal shops to our own 12-week Drupal Career Online to now providing the technical curriculum for Acquia U, one training element that spans audiences and is continually driven home is the importance of being nimble.


read more

Categories: Elsewhere

Acquia: Explaining Drupal, the pragmatic choice – meet David Aponovich

Planet Drupal - Thu, 08/01/2015 - 16:48
Language Undefined

David Aponovich knows the web content management business far beyond just the "Drupalsphere". I was thrilled when he joined Acquia from Forrester Research in 2014, since I believe his voice, experience, and insight can help convince more businesses of the benefits of using Drupal, especially given the upcoming release of Drupal 8. He and I sat down at DrupalCon Amsterdam – David's first Drupal community event – and talked about digital transformation from the "information superhighway" to today, corporations and open source software as a pragmatic choice, and how the definitions of cooperation and competition are changing in business today.

Categories: Elsewhere

Cheppers blog: Busy January at Cheppers

Planet Drupal - Thu, 08/01/2015 - 16:11

First of all - Happy New Year everyone! 2015 will be a fantastic year and we at Cheppers are ready to kick off! Let's see how we are going to start the year.

Categories: Elsewhere

Blink Reaction: Part Four: IDE Integration

Planet Drupal - Thu, 08/01/2015 - 15:32

At this point we have our VM running and performance tuned. Now that we have a synced directory on our host machine, it’s easy to see how we copy our site onto the VM. You may have already done this, and that’s okay! Let’s integrate the VM with our IDE so we can push our changes much more easily.

Categories: Elsewhere


Subscribe to jfhovinne aggregator - Elsewhere