Skip to Content

Planet Drupal

Syndicate content
Drupal.org - aggregated feeds in category Planet Drupal
Updated: 1 day 20 hours ago

Four Kitchens: Making reactive Headless Drupal 8 interfaces with Meteor

17 July 2015 - 2:30pm
Meteor + Drupal = Real time Drupal interfaces

Meteor is a JavaScript framework that enables developers to quickly create reactive, highly accessible applications. It can be an incredibly powerful tool, especially when paired with Drupal, which is a great content management system that makes it really easy to create well-structured content models and interact with data.

Why not combine the two and let Drupal provide Meteor with semantic data with Meteor rendering that data in a reactive way?

Drupal How-Tos
Categories: Drupal

Aten Design Group: The Publishing Experience on HRW.org

17 July 2015 - 12:34pm

Human Rights Watch (HRW) has been sharing important stories for over 30 years and we were excited about enhancing the digital story-telling experience in the latest relaunch of HRW.org. Out-of-the-box, Drupal provided a great platform for us to craft tools that matched HRW’s internal publishing workflows, while allowing their publishers to create long-form content with videos, galleries and other rich content.

Embedded Media

Aten's design team set the bar with the new design direction for HRW.org. Their vision for the long-form articles included flexibility for embedding media content throughout the text. After a lengthy evaluation period with Drupal’s Media module, it become clear that HRW needed more flexibility than it provided. In addition to embedding file based media (i.e. images), there were requirements around embedded text based content like quotes and callouts for other node based content. For consistency, we went with the Node Embed approach that we’ve blogged about before. Having a node-based workflow also provided a familiar workflow for HRW’s publishers.

Long-form Reports

One of HRW’s most important tasks is creating in-depth reports on certain issues around the world. It's not uncommon for these reports to approach 100 pages In PDF form. Two goals of the relaunch included the report creation workflow in Drupal and improving report navigation.

Report Creation Workflow

HRW has an internal workflow for editing and publishing reports that they’ve used for years. The end product of that workflow is a printed report and an online HTML version. Rather than trying to force a new internal workflow, we discussed pain points HRW had with their current process and built a couple tools to provide a better experience.

HTML Upload

When creating report nodes in Drupal, HRW can upload the HTML file that was created outside of the content management system. The upload process adds anchor tags and generates a table of contents based on semantic heading tags, detects image references that do not exist on the site yet, and makes a few other formatting changes The report content and table of contents are then saved in the database rather than processing the uploaded content on the fly.

Report Navigation

In past iterations, reports were broken up into many pages. Now, users can use the table of contents to quickly jump to relevant sections of the report. Having reports on a single page also allows users to use built in browser tools like “Find” to search for keywords.

Featured Content

HRW has many topic and location based landing pages where editors can curate content. HRW wanted the flexibility to manually feature content or, given the large number of these pages, have the most relevant automatically show up. To achieve this, we used Views, Entity Reference, and a custom module to tie the two together. The custom code checks the Entity Reference field for manually curated content then utilizes Views to pull the relevant content into the remaining content slots available. This allows HRW to mix curated and automated content easily without having to choose one approach over the other.

Related Content

Rather than showing users additional content at the bottom of an article based on time or tag, we worked with HRW to craft an algorithm, or scoring system, to display related content. When deciding which relevant content to show, date, geography, and topic are all taken into consideration. Similar to featured content, HRW has the flexibility to manually relate content on any article with the algorithmic suggestions filling missing slots.

Sharelines

Once HRW publishes important information, they leverage social channels like Twitter to help spread the word. We provided HRW publishers the ability create curated Sharelines that are displayed prominently for users to Tweet directly from the article.

It was exciting to work on such a large publishing project and help provide tools to help tell important stories in many languages. We hope you enjoy browsing the new HRW.org!

Categories: Drupal

Four Kitchens: Nearly Headless Drupal

17 July 2015 - 11:31am

Drupal is a pretty strong content manager, allowing you to build robust data models, easily enable content revisioning, and build a publishing workflow complex enough for even the strictest of editorial standards. However, the blistering speed of development on Drupal 8 appears glacial when compared with the rate of invention on the frontend of web development.

Drupal
Categories: Drupal

OSTraining: Use the Masquerade Module to Test Drupal Roles

17 July 2015 - 11:27am

If you have a large Drupal site, you may have a large number of roles and users.

To thoroughly test your site and make sure everything is working correctly, it's smart to browse your site under different roles.

Yes, you can create fake accounts for each user role, but that becomes very cumbersome if you have more than a couple of roles.

The Masquerade module is very easy to use, and it allows yourself to see the site through the eyes of any user you choose:

Categories: Drupal

Acquia: Gender balance in tech sales through data-driven, objective hiring

17 July 2015 - 9:48am
Language Undefined

At a recent Acquia all-company meeting, I was glad to hear that half of the current group of Acquia U students and 7 out of 12 of the latest "BDR" hires in Sales were women. Acquia's CEO, Tom Erickson added that this was the result of some "objective, data-driven" hiring practices. I had to know more. I got Acquia Senior Manager of Business Development and Sales, Chris Hemberger on the line to talk about all of this.

Categories: Drupal

Drupal core announcements: Recording from July 17th 2015 Drupal 8 critical issues discussion

17 July 2015 - 6:18am

This was our 8th critical issues discussion meeting to be publicly recorded in a row. (See all prior recordings). Here is the recording of the meeting video and chat from today in the hope that it helps more than just those who were on the meeting:

If you also have significant time to work on critical issues in Drupal 8 and we did not include you, let me know as soon as possible.

The meeting log is as follows (all times are CEST real time at the meeting):


[11:11am] jibran: https://www.drupal.org/node/2525910
[11:11am] Druplicon: https://www.drupal.org/node/2525910 => Ensure token replacements have cacheability + attachments metadata and that it is bubbled in any case [#2525910] => 149 comments, 22 IRC mentions
[11:12am] alexpott: https://www.drupal.org/node/2525910, https://www.drupal.org/node/2493911 is the issue dawehner is talking about
[11:12am] Druplicon: https://www.drupal.org/node/2525910 => Ensure token replacements have cacheability + attachments metadata and that it is bubbled in any case [#2525910] => 149 comments, 23 IRC mentions
[11:12am] Druplicon: https://www.drupal.org/node/2493911 => Update guzzle, goutte and mink-goutte-driver to the latest release [#2493911] => 140 comments, 6 IRC mentions
[11:13am] dawehner: GaborHojtsy++
[11:13am] dawehner: GaborHojtsy++
[11:13am] alexpott: https://www.drupal.org/node/2524082 is the config overrides https://www.drupal.org/node/2524082
[11:13am] Druplicon: https://www.drupal.org/node/2524082 => Config overrides should provide cacheability metadata [#2524082] => 110 comments, 32 IRC mentions
[11:13am] Druplicon: https://www.drupal.org/node/2524082 => Config overrides should provide cacheability metadata [#2524082] => 110 comments, 33 IRC mentions
[11:14am] GaborHojtsy: https://www.drupal.org/node/2338081
[11:14am] Druplicon: https://www.drupal.org/node/2338081 => Local Tasks, Actions, and Contextual links should use a TranslationWrapper to encapsulate safe translatable strings from YAML files [#2338081] => 62 comments, 16 IRC mentions
[11:14am] jibran: https://www.drupal.org/node/2493911
[11:14am] Druplicon: https://www.drupal.org/node/2493911 => Update guzzle, goutte and mink-goutte-driver to the latest release [#2493911] => 140 comments, 7 IRC mentions
[11:15am] WimLeers: https://www.drupal.org/node/2525910
[11:15am] Druplicon: https://www.drupal.org/node/2525910 => Ensure token replacements have cacheability + attachments metadata and that it is bubbled in any case [#2525910] => 149 comments, 24 IRC mentions
[11:15am] WimLeers: https://www.drupal.org/node/2532490
[11:15am] Druplicon: https://www.drupal.org/node/2532490 => Unrouted URLs break toolbar but are hidden by caching [#2532490] => 31 comments, 8 IRC mentions
[11:17am] WimLeers: https://www.drupal.org/node/507488?page=1#comment-10127746
[11:17am] Druplicon: https://www.drupal.org/node/507488 => Convert page elements (local tasks, actions) into blocks [#507488] => 280 comments, 57 IRC mentions
[11:22am] WimLeers: plach's issue: https://www.drupal.org/node/2351015
[11:22am] Druplicon: https://www.drupal.org/node/2351015 => URL generation does not bubble cache contexts [#2351015] => 300 comments, 57 IRC mentions
[11:23am] Fabianx-screen: https://drupalreleasedate.com/ shows 997 majors and 376 added in the last year.
[11:24am] jibran: https://www.drupal.org/node/2504141
[11:24am] Druplicon: https://www.drupal.org/node/2504141 => Information disclosure/open redirect vulnerability via blocks that contain a form [#2504141] => 66 comments, 12 IRC mentions
[11:28am] dawehner: https://github.com/guzzle/guzzle/issues/1166
[11:29am] dawehner: https://www.drupal.org/node/2493911
[11:29am] jibran: https://www.drupal.org/node/2493911#comment-10124104
[11:29am] Druplicon: https://www.drupal.org/node/2493911 => Update guzzle, goutte and mink-goutte-driver to the latest release [#2493911] => 140 comments, 8 IRC mentions
[11:29am] Druplicon: https://www.drupal.org/node/2493911 => Update guzzle, goutte and mink-goutte-driver to the latest release [#2493911] => 140 comments, 9 IRC mentions
[11:37am] dawehner: https://www.drupal.org/node/2528178
[11:37am] Druplicon: https://www.drupal.org/node/2528178 => Provide an upgrade path for #2354889 (block context manager) [#2528178] => 45 comments, 9 IRC mentions
[11:38am] dawehner: https://www.drupal.org/node/2528178#comment-10123746
[11:38am] Druplicon: https://www.drupal.org/node/2528178 => Provide an upgrade path for #2354889 (block context manager) [#2528178] => 45 comments, 10 IRC mentions
[11:43am] jibran: https://www.drupal.org/node/2464427#comment-10127680
[11:43am] Druplicon: https://www.drupal.org/node/2464427 => Replace CacheablePluginInterface with CacheableDependencyInterface [#2464427] => 94 comments, 9 IRC mentions
[12:14pm] dawehner: https://www.drupal.org/node/2338081
[12:14pm] Druplicon: https://www.drupal.org/node/2338081 => Local Tasks, Actions, and Contextual links should use a TranslationWrapper to encapsulate safe translatable strings from YAML files [#2338081] => 62 comments, 17 IRC mentions

Categories: Drupal

OSTraining: Can't Find the "Install new module" Link in Drupal?

16 July 2015 - 4:54pm

When developers install Drupal modules, they rely on Drush or version control to manage their work.

However, most ordinary Drupal users do everything through the admin interface. They install modules via the "Install new modules" link.

Sometimes that link goes missing. If you can't find your "Install new modules" link, here are four possible solutions.

Categories: Drupal

DrupalCon News: Meet the Local Community!

16 July 2015 - 9:42am

The European DrupalCon in 2015 will take place in the beautiful city of Barcelona, one of the most visited and explored Spanish and European destinations for visitors from all around the world. But beyond the touristic appeal, Spain and Barcelona are the houses of very active and healthy Drupal communities.

Categories: Drupal

Pronovix: Interview with a d8upgrade user

16 July 2015 - 6:18am

If you are still hesitating if it's worth the effort to sign up for d8upgrade, we wanted to give you an account from one of our users who did already do so. We asked omong_kosong, if we could interview him for a blogpost, what follows are his answers to the questions we sent him.

What do you think about the d8upgrade service? Was it helpful?

Categories: Drupal

Code Karate: Create Secret URLs with Drupal 7 Token Content Access

16 July 2015 - 5:33am
Episode Number: 209

Have you ever wanted to create a page on your Drupal 7 website and send it over to a friend or group of people… but you don’t want the general public to see it? You could always set it up so they just log in, but that’s an extra step and not all of the people you want to send this to have user accounts on your site.

Tags: DrupalDrupal 7Site BuildingDrupal Planet
Categories: Drupal

Commerce Guys: Five things you should know about Drupal 8 on Platform.sh

16 July 2015 - 4:56am
If you are thinking about building something on Drupal 8, or maybe you saw the the recent television interview with our CEO Frederic Plais on France’s BFM Business channel, then here is what some of the hype is all about

1. Drupal 8 is coming, and Platform.sh has been ready since 2014 While other PaaS providers are playing catch-up, we’ve been running Drupal 8 successfully since last year, providing Drush 7 support and a Symfony-based CLI for local development. Platform.sh is also multi-technology, so that Drupalists looking to “get off the island” can easily run Drupal and Symfony and very soon Drupal and NodeJS side-by-side.

2. Leading Swiss publisher Suedostschweiz.ch is using Platform.sh and Drupal 8 in production, others are already in the pipeline Since going live in June, Suedostschweiz.ch has been providing Switzerland with cutting-edge news, radio and TV in the form of a specially developed Drupal 8 portal. Since its launch, the site has taken over 12m hits in a 7 day period, making it one of the largest Drupal 8 sites in the world right now.

And that’s just the beginning. We have several other Drupal 8 sites that are currently in development and we’re working with our partners to deliver many more.

See more on Südostschweiz see the following release:
https://platform.sh/press/2015/05/groundbreaking-drupal-8-news-portal-go...

3. Platform.sh and Fastly (CDN) unleash Drupal 8 tagged caching News portals and other sites with frequent content updates have been subject to at least one serious constraint up to now; careful scheduling of content updates that requires the entire global cache to be invalidated and re-built. The downside being massive spikes as every request is passed through to your backend webservers. That’s now a thing of the past, as Platform.sh can selectively invalidate both the reverse proxy, and via our own specially developed API, the CDN itself. This is one of the reasons Suedostschweiz.ch selected Platform.sh for its new hosting PaaS.

4. The Drupal Association (DA) is using Platform.sh for Drupal 8 (D8) Usability Testing The Drupal 8 Usability Testing that was recently conducted in Minneapolis made great use of Platform.sh. This phase of Drupal 8 development is crucial to the success of the new CMS, and benefited greatly from Platform.sh’s unique ability to spin up multiple identical environments - on-demand and within seconds - for testing against many hundreds of different variables. Many of Drupal's leading lights are clearly recognising the value of Platform.sh to their landmark projects.

You can find out more on the D8 usability testing here: https://groups.drupal.org/node/470398

5. Platform.sh Enterprise offers a Drupal 8-ready, triple-redundant architecture that is secure, resilient and effortlessly scalable. 24/7 white glove support and comprehensive documentation round out the offer. With highly credible financial backers (including the recent grant from the European Union’s Horizon 2020 program see https://platform.sh/2015/06/european-horizon-2020-grant/ ), we are accelerating our roadmap with a wealth of features that will boost the benefits of Drupal 8 and everything that goes with it.

Interested? Then get in touch at https://platform.sh/contact/
Categories: Drupal

Symphony Blog: How to share Drupal content via Facebook with correct images

16 July 2015 - 1:41am

When you share a post of your Drupal site via Facebook, it will automatically detect the images of your node for you to choose. But sometimes, it does not detect any images, or the detected images are not what you want. How can you deal with that?

An easy method is uploading the main image manually. That's fine, because you are the owner of the site, you know which ones to choose. However, if your readers share that piece of content and it has an ugly image, it does not look attracting at all.

In this tutorial, we show you how to set meta data for your Drupal nodes so the correct images will be chosen, when you share them via Facebook.

read more

Categories: Drupal

KnackForge: Drupal : Add an icon to the menu links

15 July 2015 - 11:33pm

We all like decorated items than normal ones. Everyone like to add icon/image to their site's menu links but we need some tricks to add that into our drupal site's menu link. I am going to show you various methods to add an icon/image to the drupal menu links.

1. theme_menu_link() : 

It would return html elements for the menu and it's submenu. We can change the menu html elements using this function and this function must be written in our theme's template.php file. In this example, I am going to add icons to the main menu.

/** * Implementation of theme_menu_link__MENU_NAME(). */ function THEME_NAME_menu_link__main_menu(array $variables) { $element = $variables ['element']; $sub_menu = ''; if ($element ['#below']) { $sub_menu = drupal_render($element ['#below']); } $icon = 'icon-' . $element['#title']; $output = l($icon . $element ['#title'], $element ['#href'], $element ['#localized_options']); return '<li' . drupal_attributes($element ['#attributes']) . '>' . $output . $sub_menu . "</li>\n"; }

This will add our new unique class to all main menu links, we could simply add the icons with class using css style.

2. Menu Icons :

The menu icons is a drupal contributed module. It is one of the simplest solutions to add the icons/images through UI. This module allows you to upload an image in the menu-item configuration form.

Categories: Drupal

Drupal @ Penn State: ELMSLN - Coming to a camp near you

15 July 2015 - 2:36pm

I was made aware that it’s been close to a year since I actually did a demo of the reason that I contribute so many modules to drupal. org. For those that don’t know, the reason I exist is a project called ELMS Learning Network. It is a Drupal 7 based deployment methodology that takes the many parts of an LMS and fragments them across a series of drupal distributions.

Categories: Drupal

Cheeky Monkey Media: Into the Fire with Foundation and The Big “D”rupal

15 July 2015 - 2:26pm

Cheeky Monkey broke my Foundation cherry.  It’s been a pleasurable experience.

Coming from frameworks like Zen Grids (+ Drupal Theme) and Susy2 Grids, I can appreciate (and need) some major control over the grids.  I have to say though, foundation does a bang up job of letting you control the ‘big stuff’ with ease, and still being able to get down into the nitty griddy(see what I did there?) -- and change what you like without too much fuss.

Drupal, Drupal he’s our man.

And then, oh yeah, there’s a Drupal theme for it!  ...

Categories: Drupal

Four Kitchens: Introducing Saucier

15 July 2015 - 2:11pm

With the first party API building tools built into Drupal 8 core, there’s been a lot of talk about building semantic APIs in Drupal; when, how, and why you should or should not. However, a commonly overlooked piece of this picture is how to go about actually consuming these APIs. And as it turns out, consuming an API, even a well designed one, can present a number of challenges. That’s why we created Saucier, a Node.js framework used to quickly create web pages from data that has been consumed from a Drupal API.

JavaScript Drupal
Categories: Drupal

OpenConcept: Conforming to coding standards with linters

15 July 2015 - 9:27am

At the the DrupalNorth code sprint, I spent some time chatting about code linters, and how to use them to ensure your code conforms to coding standards. So, I thought I'd share the process that works for me.

If you find a better process, please blog about it and post a link in the comments!

This tutorial assumes:

  • You write or modify code in a language like PHP, JavaScript, CSS, Bash, etc.
What is a linter?

Simply put, a linter is a static analysis tool that you can run to ensure that your code is free from syntax and/or style errors.

Types of linters

To help me prioritize fixing linter messages, I usually classify linters into two types:

  • Linters that check for syntax errors, and,
  • Linters that check for coding standards violations.

I consider linters that check for syntax errors manditory, since I can't really think of a time when I would want code which contains syntax errors (in PHP and JavaScript, syntax errors cause unrecoverable fatal errors if the file containing the code is ever parsed (i.e.: white screen of death, JavaScript engine halting)). I will not commit code unless these types of linters give the okay.

I consider linters that check for coding standards violations strongly recommended (as they affect the maintainability of your code), but technically optional (because code that doesn't conform to standards still works). I try to avoid committing code that doesn't pass these linters; but there are some circumstances when that is unavoidable (e.g.: if I have to commit a contributed module, or if it's a hotfix and there's a plan to make the code more-maintainable later).

Checking for syntax errors

Many interpreted languages and shells have a syntax-checker built into them, for example:

  • php -l $file will check a PHP script for syntax errors,
  • bash -n $file will check a BASH shell script for syntax errors,
  • ruby -c $file will check a Ruby script for syntax errors,
  • perl -c $file will check a Perl script for syntax errors,
  • zsh -n $file will check a ZSH shell script for syntax errors, and,
  • fish -n $file will check a Fish shell script for syntax errors.

I wasn't able to find any built in syntax linters for JavaScript, Python, and PowerShell, but please leave a comment if you know of one.

Checking for coding standards

Github has put together a showcase of clean code linters, but note that they are limited to ones developed on Github.

As a Drupal developer, I usually use:

Since Drupal's coding standards differ slightly from other communities, all of these tools need to be configured slightly before you can use them. I'll explain how to install and configure all of these below.

Note that PHP CodeSniffer, the Drupal coding standards sniffs, and the Drupal Best Practice sniffs are used by the Drupal Automated Project Review tool.

PHP CodeSniffer

To set up PHP CodeSniffer, I'm assuming that:

  • You know how to use the command-line,
  • PHP is installed on your machine and in your PATH,
  • You have installed Composer,
  • You want to install PHP CodeSniffer globally (i.e.: for all projects), and,
  • Composer's ~/.composer/vendor/bin folder is in your PATH.
Installing
  1. Tell Composer to install PHP CodeSniffer globally:

    composer global require 'squizlabs/php_codesniffer'
  2. Install the Coder module globally, so we can use it's Drupal coding standards and best practices sniffs:

    composer global require 'drupal/coder'
  3. Register the Drupal and DrupalPractice Standards with PHP CodeSniffer:

    phpcs --config-set installed_paths ~/.composer/vendor/drupal/coder/coder_sniffer
Use

To check that a file conforms to the Drupal coding standards, run:

phpcs --standard=Drupal $file

To check that a file conforms to the Drupal best practices, run:

phpcs --standard=DrupalPractice $file Setting a default coding standard

It is possible to set a default coding standard (i.e.: so you can just run phpcs $file), but:

  • You still have to run

    phpcs --standard=DrupalPractice $file

    to check that the file conforms to best practices, and,

  • If you ever have to work on non-Drupal projects, you'll have to explicitly state:

    phpcs --standard=PEAR $file

    for php's default functionality.

Instead of setting a default, you could create an alias in your shell. For example, if you use Bash, adding...

alias drupalcs='phpcs --standard=Drupal'

... to your .bash_profile or .bashrc will let you run...

drupalcs $file

... instead of...

phpcs --standard=Drupal $file

If you use another shell, this is left as an exercise to the reader.

Fix coding standards violations with the PHP Code Beautifier (phpcbf)

PHP CodeSniffer also ships with a command called phpcbf (PHP Code Beautifier), which can fix some coding standards violations automatically. For example, to convert a file to the Drupal coding standards, run:

phpcbf --standard=Drupal $file

A word of warning: I haven't tested phpcbf very extensively, so your mileage may vary. It may eat your code and/or socks.

Ignoring files, or parts of a file

You might want to ignore coding standards violations on legacy code that the team has decided isn't worth the effort to convert to coding standards.

  • You can ignore whole files by adding a

    // @codingStandardsIgnoreFile

    comment at the top of the file, immediately after the opening PHP tag.

  • You can ignore certain parts of a file by surrounding that part of the file with

    // @codingStandardsIgnoreStart

    and

    // @codingStandardsIgnoreEnd

    comments.

See the PHPCodeSniffer advanced usage instructions for more information.

ESLint

To set up ESLint, I'm assuming that:

  • You know how to use the command-line,
  • You have installed Node.js,
  • Node.js' npm ("Node Package Manager") executable is in your PATH, and,
  • You want to install ESLint globally (i.e.: for all projects).
Installing
  1. Tell npm to install ESLint globally:

    npm i -g eslint

    On certain machines, you may need to run this command with sudo; but try it without sudo first.

Configuring

ESLint needs a .eslintrc file (and usually, a .eslintignore file as well) in your project's root directory.

If you're working on a Drupal 8 project, ESLint will just work, because it's configuration files ship with Drupal 8.0.x core. For other projects, you'll need to copy .eslintrc from Drupal 8 core.

Drupal 8.0.x core's .eslintignore probably won't work for your project, but I've put together some templates for your D7 projects, and you can also refer to the official .eslintignore documentation if you need to customize them further.

Use

To check that a JavaScript file conform to Drupal coding standards, run:

eslint $file CSSLint

To set up CSSLint, I'm assuming that:

  • You know how to use the command-line,
  • You have installed Node.js,
  • Node.js' npm ("Node Package Manager") executable is in your PATH, and,
  • You want to install CSSLint globally (i.e.: for all projects).
Installing
  1. Tell npm to install ESLint globally:

    npm i -g csslint

    On certain machines, you may need to run this command with sudo; but try it without sudo first.

Configuring

CSSLint needs a .csslintrc file in your project's root directory.

If you're working on a Drupal 8 project, CSSLint will just work, because it's configuration file ships with Drupal 8 core. For other projects, you'll need to copy .csslintrc from Drupal 8 core.

Use

To check that a CSS file conforms to Drupal coding standards, run:

csslint $file Running the coding-standards linters

Once PHP CodeSniffer, ESLint, and CSSLint have been installed and configured, you can:

  • Check that a PHP file conforms to Drupal coding standards with:

    phpcs --standard=Drupal $file
  • Check that a PHP file uses Drupal best practices with:

    phpcs --standard=DrupalPractice $file
  • Check that a JavaScript file conforms to Drupal coding standards with:

    eslint $file
  • Check that a CSS file conforms to Drupal coding standards with:

    csslint $file
A note on the history of Drupal coding standards checkers

In the past, most of us used the Coder module to check that our work conformed to the Drupal coding standards and documentation standards. However, the Coder module relied on parsing PHP, JavaScript, etc. code using regular expressions, which were hard to understand, write, and maintain, and couldn't catch all cases (because almost all programming languages are parsed with tokenizers and context-free grammars).

The move to PHP CodeSniffer started with the Drupal Code Sniffer (drupalcs) module, which eventually was imported into the Coder module's 7.x-2.x branch. It concentrated on checking PHP code only.

As the Drupal Community developed our own CSS coding standards and JavaScript coding standards, we needed a way to automatically check those too. Rather than writing our own parsers, we decided to "get off the island" and use what the wider web development community was using.

Stay tuned

Next week, I will blog about automatically running linters when you commit code, which can be pretty useful.

Topic: Primary Image: 
Categories: Drupal

Promet Source: Better Debugging: Conversations with Duckie

15 July 2015 - 8:50am
Learning to Strategize & Plan with Help from an Inanimate Friend

Ever wondered what the best sounding board for a debugging plan might be? If you could describe the ideal listener, which qualities come to mind?

A wish list might include: patient, calm, totally uncritical and not rushing off to the next fire that needs putting out. Hard to find someone who fits the bill, am I right? Well, terrible puns aside, our team has recently discovered someone who does fit the "bill" — as in duck bill.

Categories: Drupal

Mediacurrent: Mediacurrent is Gearing Up for NYC Camp

15 July 2015 - 6:46am

We all know one of the best things about Drupal is the community. If you’re looking to learn more or make connections, there’s almost always a meet-up, camp or other event nearby.  

Categories: Drupal

Palantir: Saying No to Say Yes

15 July 2015 - 6:20am

At DrupalCon Los Angeles I gave a Core Conversation with the unassuming title "No", where I argued that in order for the Drupal project to be successful in the long term, it needs to have a clear and explicit focus. While in part it was an excuse for me to work Grumpy Cat pictures into a DrupalCon presentation, the broader point is one that I believe bears reiterating.

Companies or projects that can't focus tend to have problems. Instead of doing one thing well, they end up doing lots of things poorly. For instance, in an infamous 2006 internal memo that became known as “The Peanut Butter Manifesto”, a senior executive at Yahoo! argued that the company lacked a cohesive vision and was spreading itself too thin trying to be everything to everybody… like peanut butter on bread. In his words, "We lack a focused, cohesive vision for our company. We want to do everything and be everything – to everyone." Sure enough, Yahoo! faltered badly with no killer feature or service and is still struggling to make up lost ground from that era.

Jack Welch, former CEO of General Electric, said it bluntly: "If you don't have a competitive advantage, don't compete." Put another way, if you aren't striving to be the best at something, it's not worth doing. Say "no" to anything where you aren't working to be the best.

What is Drupal's focus?

What do we, as Drupal, want to focus on? And how do we determine if we're doing so successfully? There's no clear, explicit consensus on that within the community. We try to support new contributors and let "rough consensus" decide what we accept or not. That is great for community building, but it doesn't scale to product management at the scale Drupal is now. There’s no way to establish a clear, explicit consensus on what the project wants to focus on (and not focus on), or how to determine if we’re doing so successfully.

Emma Jane Westby called this problem "The Danger of Having No Why" at DrupalCon Austin. Our nominal mission statement roughly boils down to "be a good CMS". What being a good CMS means, and what problems Drupal seeks to solve, is an undefined question. The mission statement doesn't provide any guidance in terms of what functionality to focus on, or what type of user to emphasize. In her words, "We need to stop pretending to be something that everyone will love."

Without a clear and explicit focus, Drupal runs the risk of becoming what Jeff Eaton has called The CMS of the Gaps: a "generic" system that tries to be "good enough" for everyone, but is not great for anyone. That in turn makes Drupal vulnerable to increasingly strong focused tools (Wordpress for blogging, PHPBB for forums, Symfony and Zend Framework and Laravel for custom business logic, etc.) that are not standing still, but getting stronger and more inter-operable every year. We can't "do everything and be everything to everyone" if we want to do that well.

What of Drupal 8?

In the five years since I last talked about its audience priorities, Drupal has made a radical shift. Drupal 8 jettisoned many old assumptions, made significant cultural changes, and reinvented itself as a more modern content management platform.

Drupal 8 shifts the emphasis more heavily toward a certain class of content management that makes a discrete distinction between usage and administration, with a strong emphasis on content strategy and platonic content.

As Drupal has become a stronger CMS, it has become a weaker pure framework. And that's fine, given the shifts in the rest of the PHP market. Tools like Symfony and Zend Framework fill that space better today, while Drupal is a far better content management platform than rolling your own on top of a bare framework. That specialization means end users still have Free Software options for different use cases, and they're better than expecting one generic program to serve every use case.

Looking at what we've accomplished in just a few short years, I am incredibly proud of the work the community has done, both technically and socially. However, the process of getting there was incredibly and unnecessarily painful. Because we didn’t have a well-defined decision-making process, we saw increased conflict and burnout within the Drupal core developer community. Quite simply, the path that we are on will not get us where we want to be.

The new core governance model is a big and positive step forward. Subsystem maintainers and the Product Owners now have greater clarity and autonomy in their roles. But those people need to not only have but communicate, and agree upon, a clear focus for both the project and for their areas of responsibility. If we're all pulling in different directions, or worse no direction, then we're back where we started. If we can all be in explicit alignment in terms of what the goals of the project are, and are not, we can all drive toward that "Why" faster and more effectively, both for the remainder of Drupal 8's development and well into the future.

Deciding Who Drupal Is (And Is Not) For

If we want to improve developer morale and avoid defaulting to the “CMS of the Gaps”, then we need to prioritize certain tasks and use cases at which Drupal needs to excel. And that means saying “no” to other tasks and use cases. That distinction needs to be one that is both explicitly made and communicated, so that we know that at the end of the day everyone is on the same page.

This means that as a project, we need to be thinking about questions such as:

  • What edge cases are just not worth supporting due to the instability they'd cause in the system?
  • What types of applications are we okay with people not building in Drupal?
  • What features are we willing to not accept, because they make the code too brittle or complex for the other use cases we support?
  • What site is just "too simple" for Drupal to be an appropriate tool?
  • What site is just "too complex" for Drupal to be an appropriate tool?
    • There are a couple of ways we can go about answering these questions:

      One would be a revision to Drupal's mission statement to make it more targeted and actionable. The current mission statement doesn't provide any guidance in terms of what functionality to focus on, or what type of user to emphasize. A mission statement should be a statement that you can always refer back to and say "does this thing support that statement? If yes, do it. If not, say no."

      Another useful tool is personas. Personas are an important part of content strategy and user experience for a website, but also an important part of product development. They can help identify the users that are being targeted, and how to serve their needs, but, by extension, those features that are not useful to an identified persona are easy to exclude.

      Take the Content Working Group's personas for Drupal.org users, for instance. They lay out five personas: Newcomer, Learner, Skilled, Expert, and Master. The purpose of Drupal.org's content is to help people move up that scale as smoothly as possible. However, the working group makes this very explicit statement:

      For further clarity and focus primary and secondary personas were determined. Primary personas are who we design for first. Each primary persona requires their own set of features and content, and the needs of a primary persona will not be met if we do not design for them explicitly. The needs of secondary personas can mostly be met by focusing on the primary personas. However, there are a few needs specific to them that we will need to accommodate for.

      Based on user interviews, Learner and Skilled were determined as primary personas. Secondary persona is Expert. Newcomer and Master are tertiary personas.

      That is, Drupal.org is "for", primarily, Learner and Skilled users, and helping those users get to the next higher level. Content decisions should be made, primarily, to support those users. Content that would help an Expert or Master user is fine, but only if it doesn't hinder the primary goal of aiding and training Learner and Skilled users.

      That provides a clear framework for deciding not only what content and information architecture to adopt, but what to not bother spending resources on and, potentially, what content to reject (at least from high-level pages) as it would confuse that primary audience.

      Similarly, we could develop "use case personas" for Drupal. These personas are not archetypical people but archetypical sites or applications. For what type of site or application do we want Drupal to be the world-recognized obvious best choice for? And in order to achieve that, for what type of site or application are we willing to say Drupal just is not going to be the best fit and likely never will be? We need to ask, and answer, both questions.

      At the very least, we need to define some metrics to define our focus. In late 2010, on the eve of Drupal 7's release, I noted that the HTML5 Working Group has a very clear metric by which it guides its focus:

      In case of conflict, consider users over authors over implementers over specifiers over theoretical purity.

      Drupal needs to define its "constituency tie-breaker" metric and apply it consistently. Favoring different users over others in some issues, but the other way around in others, does not help Drupal succeed. It just confuses both contributors and users.

      Getting to “Yes” by Saying “No”

      Focusing on a goal is how one achieves it. Focus is a prerequisite for effectively achieving that goal. And focusing on that goal means not focusing on other potential goals.

      Few people enjoy saying "no" to someone. It's difficult. It should be difficult. But that doesn't mean we can avoid doing it. Sometimes we need to say “no” in order to make an explicit decision, as opposed an implicit amorphous one. Implicit decisions are those that get made for us by us environment, by our process, or by someone else we don't know. Those kinds of decisions are rarely the best ones. To once again quote Jack Welch, "Control your own destiny or someone else will."

      Saying “no” and saying “yes” are complementary tasks. While we can’t say “yes” to every feature, by explicitly eliminating a few, we can focus our efforts, and our decision-making about what to include or not include, on those that remain. And by building a collective priority of audiences and use cases that puts us all on the same page, we can support those users at the top of our list even better than we do today.

      So as we wrap up Drupal 8 and start looking toward 8.1 and eventually Drupal 9, I put the question to everyone: To what shall we focus our efforts on, and to what we say “no”?

      Those questions cannot be separated.

Categories: Drupal


Google+
about seo