Drupal

Acquia Developer Center Blog: Introducing Bolt, a Development Tool for Generating New Drupal 8 Projects

Planet Drupal - 25 May 2016 - 9:09am

It's my pleasure to introduce Acquia Bolt, a development tool for generating new Drupal projects using a template derived from our Professional Services' best practices.

We began building and using Bolt internally over the past year. Our goal was to codify a set of tools and conventions that would allow us to:

Tags: acquia drupal planet
Categories: Drupal

Mediacurrent: Dropcast: Episode 20 - Kind of a big deal

Planet Drupal - 25 May 2016 - 8:53am

This episode we hit a land mark of twenty episodes, so instead of picking on Mario the entire time, we talk about our favorite moments at Drupalcon in New Orleans. Of course this is funny since half of us didn't actually attend the 'Con. Other episode titles considered: "Bob and Mario live vicariously through Mark and Ryan"

Categories: Drupal

Digiteka

New Drupal Modules - 25 May 2016 - 8:03am

Implement Digiteka video monetization.

Automatically enrich your content with relevant videos

Categories: Drupal

Drupal Bits at Web-Dev: Drupal file_scan_directory option nomask

Planet Drupal - 25 May 2016 - 7:44am

Other than a quick sample of blocking a specific file extension using the 'nomask' option, the documenttation for Drupal's file_scan_directory() does not help much with how to bock content from certain directories.  The documentation says

The  Perform a regular expression match">preg_match() regular expression of the files to ignore.'

So it leaves you to believe that any regex should work.   So setting

$options['nomask'] = "#(/deleted/)#"

should block any directory named 'deleted'.  The problem is, it doesn't work that way.   In file_scan_directory() the regex is not run against the full path of the file, it is only run against the directory or filename recursively.  It is not evaluating  'directory1/subsection/deleted/index.html' , where the regex above would definitely come back with a hit and reject the item.  It is first evaluating, 'directory', then 'subsection', then 'deleted'...   It does not get a hit on deleted because it is missing the slashes on each side.

One possibilty would be to remove the slashes from the regex like this:

$options['nomask'] = "#(deleted)#";

But without the slashes, it would not only reject the directory 'deleted', it would reject the directory 'not-deleted'  and the file 'faq-why-my-account-was-deleted.htm' which might have undesired consequences.

The trick to get it to reject only 'deleted' as a directory and its contents is to restrict the regex to only the start and end of the string being evaluated. like this

$options['nomask'] = "#^(deleted)$#";

and if you wanted to block 'deleted' and another directory like '_vti_cnf' it would look like this:

$options['nomask'] = "#^(deleted|_vti_cnf)$#";

 

Categories: Drupal

Mediacurrent: Security Talks at DrupalCon New Orleans 2016

Planet Drupal - 25 May 2016 - 7:11am

While I have had the privilege of attending a number of DrupalCons and camps over the years, I cannot remember one with as many sessions and BOFs (birds of a feather) on the topic of security. In addition to the security talk on the program schedule, I had a great time chatting with individuals in the hallways and a few security focused companies in the exhibit hall. 

Categories: Drupal

Mediacurrent: 6 Questions Every Project Manager Should Ask

Planet Drupal - 25 May 2016 - 6:27am

Your company’s business development team just announced a new Drupal project has been given the green light, and you will be the project manager. What do you need to do to help your development and strategy teams succeed in giving the client the best possible experience and product? You need to ask the right questions.

3 questions to ask regardless of the CMS in play

The project manager of any technical project, leveraging Drupal or some other CMS, should first and foremost ask:

1. Where is the Statement of Work (SOW) and how do I access it?

Categories: Drupal

Liip: Drupal: Dynamic IMCE Profiles

Planet Drupal - 25 May 2016 - 5:15am

Today I will describe a way to handle multiple teams with their own private file folders using the IMCE module.

Let’s pretend that we have to develop a website called awesome-website.com which consists of three (or more) different teams. The team structure could look as followed:

Every team should only be allowed to edit their own pages but no page from any other team. Therefore it would also make sense to separate the team’s file folders so that the files can be stored separately to secure its privacy.
Of course, we could simply add three IMCE profiles and define their folder access rights individually there. But what about when working with 10 teams? Or 50? Or even more? Then we definitely would prefer a more flexible solution.
Thankfully, IMCE ships with the ability to define user folders by PHP execution, how awesome! But in order to achieve this, we’ll have to set up teams as taxonomy terms first and reference them from our user entities.

Setting up the “Teams” taxonomy vocabulary

First things first: Let’s create a new taxonomy vocabulary called “Teams”. For every team that we will have on our website, we have to create a new taxonomy term in this vocabulary.
Before adding any teams as taxonomy terms though, we’ll have to add a new field called “FTP Folder” to the taxonomy vocabulary.
This field will specify the name of every team’s root folder. So, naturally it shouldn’t contain any spaces or other wicked special characters and it should be URL readable.
In order not to face any unusual results later, it is recommended to configure this field as required.

Afterwards, we can add our three terms, “Team Alpha”, “Team Beta” and “Team Gamma”.
As value for their FTP Folders, we use “team-alpha”, “team-beta” and so on.

That’s it for the taxonomy part! Now let’s link this information to the team’s users.

Adding a taxonomy term reference field to the user entity

In my case, I didn’t have multiple roles for the teams. I only had one, called “Team member”. Because every team has exactly the same rights as the others, maintaining only one role suited me best.
For really special cases, I could always just create a new role with the special permissions.

So, how do we link users to their teams the easiest? Exactly, by just adding a taxonomy term reference field to the user entity!
Let’s call this field “Team” and reference our previously created taxonomy vocabulary “Teams” with it.

Now, when adding a new user, we can select it’s team belonging and IMCE will be able to grab the needed information from there.
Yes, IMCE will be able to do that but it’s not doing it yet.
Getting the teams ftp folder for the current user is still something we have to code, so let’s proceed to the next step.

Writing a custom function to provide the accessible directories for an user

Now we need to provide IMCE the information that we’ve set up before.
We’ve created users belonging to teams, which hold the FTP root folder name for the teams.
What’s left to do, is to write a function (ideally in a custom module, in my example the module is called “awesome_teams”), that combines all information and returns it to IMCE.
Following function would do that for us:

function awesome_teams_imce($user) { $user_folders = array('cms/teams/all'); $user_wrapper = entity_metadata_wrapper('user', $user); $user_teams = $user_wrapper->field_team->value(); foreach ($user_teams as $user_team) { $user_team_wrapper = entity_metadata_wrapper('taxonomy_term', $user_team); array_push($user_folders, 'cms/teams/' . $user_team_wrapper->field_ftp_folder->value()); } return $user_folders; }

The function expects an user object as argument and will return an array of strings containing all the folder names an user is allowed to access.
Our folder structure would look like this:

  • sites/default/files/cms
  • sites/default/files/cms/teams
  • sites/default/files/cms/teams/all
  • sites/default/files/cms/teams/team-alpha
  • sites/default/files/cms/teams/team-beta
  • sites/default/files/cms/teams/team-gamma

Note: The folder “cms/teams/all” is a special folder and every user is allowed to access it.
It will be used to save files which are used globally over multiple or even all teams.

What our code does, is actually looping over all assigned teams for the given user (yes, an user can be in multiple teams!), and adding the teams ftp folder names to the array of accessible folders.

There is no “hook_imce” hook, the “_imce” in the function name does nothing till now. You can also name your function differently. The link from IMCE to our function is something we have to set up in an IMCE profile.
Let’s proceed to the last step then, shall we?

Creating the IMCE profile “Team member”

Now, as the last step, let’s create an IMCE profile called “Team member”. You’re free to define any settings as you like, there’s only one thing that will be special about this profile: The accessible directories path.

Instead of writing something constant as “cms/teams/team-alpha”, we’ll write “php: return awesome_teams_imce($user);” here.
So, the setting should look like this:

Now save the profile and you are done!

As soon as one team member now accesses the IMCE page (either via /imce or by the configured file/image fields), he will only see his team’s directories and the special directory “all” which is meant for exchange.

This wasn’t that difficult, was it?

I hope I was able to give you an insight on how to solve more complicated file permission issues with IMCE.
Don’t forget to give feedback, ask questions and follow our blog if you want to read more about our Drupal experiences at Liip!

Categories: Drupal

Rest menu items

New Drupal Modules - 24 May 2016 - 10:21pm

This module provides a REST endpoint to retrieve menu items based on the menu name.

When enabled the REST endpoint "/api/menu_items/{menu_name}" becomes available. When calling this url and adding the menu name to the url, for instance "/api/menu_items/main" you will get a full menu tree of that menu.

If you add a query parameter like "?max_depth=1" or "?min_depth=2" you are able to determine what levels in the menu tree you would like to output into the webservice.

Categories: Drupal

LevelTen Interactive: DrupalCon[densed] 2016: The Best Business Sessions

Planet Drupal - 24 May 2016 - 10:00pm

My role as a principal at LevelTen means that I spend a lot of time overseeing Accounting, Operations, and Marketing. So for my visit to DrupalCon 2016, I wanted to spend as much time as I could talking with other C-level people to see what struggles we have in common and what solutions we've come up with.

Throughout the sessions, summits, and socializing, there were a few key themes that kept coming up over and over from people who run Drupal shops. With that in mind, this post is less of a DrupalCon 2016 takeaway than a preliminary analysis of the economics of Drupal as it...Read more

Categories: Drupal

Mediacurrent: A quicker way to apply a Drupal / contrib patch

Planet Drupal - 24 May 2016 - 2:57pm

The normal Drupal instructions for applying patches are well used and reliable. However, I find them to be a little verbose, so I came up with a slightly quicker workflow.

TL;DR

The short explanation of what I do is to copy the patch's URL and run this command:

curl [patch URL] | patch -p1

Which would then become something like this:

Categories: Drupal

Metal Toad: What I Learned Today: Views Plugin Debugging

Planet Drupal - 24 May 2016 - 12:52pm
What I Learned Today: Views Plugin Debugging May 24th, 2016 Jonathan Jordan

As I've said before in my custom views filter handlers tutorial, views is amazing. Today I was writing a custom style plugin. I got the plugin to show up in the list of available formats, but whenever I saved the form, it wouldn't stick.

My Typical Method of Debugging in Drupal

Typically I would throw dpm's to debug, so I started walking through the callstack trying to find where things were going wrong. Then I ran into a line in views that called vpr(). It looked like a print_r debug statement, so I knew this was either being logged or there was a setting somewhere.

A Better Way to Debug Views Plugins

Sure enough it is part of the "Enable views performance statistics" setting to have these messages logged with watchdog. To turn it on go to /admin/structure/views/settings/advanced. Even better, when you turn Devel on, you can have them dpm'ed instead. Now I get exactly the information I need to figure out what I was doing wrong, without having to throw my own dpm's in views or ctools.

Other Views Settings for Debugging

Also, if you are just looking to debug your views query the "Show the SQL query" and "Show performance statistics" options on /admin/structure/views/settings are invaluable.

This post is part of my challenge to never stop learning.
Categories: Drupal

Chapter Three: How to Secure Drupal HTTP Headers

Planet Drupal - 24 May 2016 - 11:29am

In this blog post I will briefly overview some of the very useful HTTP response header parameters that will help to secure any website. In short - HTTP Response headers are name-value pairs of strings sent back from a server with the content you requested. More information can be found on the internet.

I will cover some of the most important security-related HTTP parameters. The original blog post was written by Scott Helme who is the creator of SecurityHeaders.io. This is a brief overview of his blog post to introduce this technique to our readers.

Categories: Drupal

Janez Urevc: Drupal's number 1 is from Switzerland

Planet Drupal - 24 May 2016 - 6:49am
Drupal's number 1 is from Switzerland slashrsm Tue, 24.05.2016 - 15:49

Swiss has traditionally been dedicated to the best quality and innovation. Some of the best things in life come from Switzerland. Did anyone mention chocolate?

Photo by Janine, released under CC BY 2.0

Drupal and free software are no exception. Many companies and individuals are dedicated to them on a daily basis. That said, it is no surprise that Drupal's number one comes from Switzerland.

Jerome from MD Systems explains how we achieved that, which are the main advantages of Drupal and why everyone should use it. Very interesting read!

Categories: Drupal

Vibrate

New Drupal Modules - 24 May 2016 - 5:57am

Vibrate module provide you functionality to vibrate your mobile user's mobile based on your selection.
Selection could be home page or any node id.
Once user access your site a popup box with customized text will appear with respect to selected node and mobile will vibrate.

Categories: Drupal

Janez Urevc: Drupal community, please meet Vijay

Planet Drupal - 24 May 2016 - 1:40am
Drupal community, please meet Vijay slashrsm Tue, 24.05.2016 - 10:40

Google summer of code 2016 started with a full swing this week. Vijay is one of the students participating in it. He is working on the Media module for Drupal 8.

He wrote an introduction blog post. I'd like to invite you to read it, say hi and follow his work as it progresses through the summer.

Welcome in the Drupal community Vijay!

Categories: Drupal

LevelTen Interactive: DrupalCon[densed] 2016: The Best Developer Sessions (Part I)

Planet Drupal - 23 May 2016 - 10:00pm

DrupalCon New Orleans was the third DrupalCon I’ve attended, and it never ceases to amaze me how much Drupal has changed over the years, and how much time and effort the community puts in -- not just into core and contrib, but also into building out third party tools, scripts, and methods that will benefit other agencies and freelancers. It really is a privilege to be a part of a community that is so incredibly committed to the values of open source and always willing to share their experience along the way.

Aside from the ...Read more

Categories: Drupal

LevelTen Interactive: DrupalCon[densed] 2016: The Best Developer Sessions (Part II)

Planet Drupal - 23 May 2016 - 10:00pm

As a beginning developer who spent the majority of the last three months learning front-end javascript frameworks and the MEAN stack, I was anxious to get re-acquainted with Drupal, all of its ‘isms, and the storied community behind it. But besides tired feet, a hangover, and a backpack stuffed with free swag, what would I take away from it all?

Looking back, it’s tough to capture all the remarkable insights from such interrelated sessions and do them justice in a single blog post, but I did come across several ideas from the con that stuck with me in one way or another. So...Read more

Categories: Drupal

LevelTen Interactive: Drupal Con[densed] 2016: The Best Developer Sessions (Part II)

Planet Drupal - 23 May 2016 - 10:00pm

As a beginning developer who spent the majority of the last three months learning front-end javascript frameworks and the MEAN stack, I was anxious to get re-acquainted with Drupal, all of its ‘isms, and the storied community behind it. But besides tired feet, a hangover, and a backpack stuffed with free swag, what would I take away from it all?

Looking back, it’s tough to capture all the remarkable insights from such interrelated sessions and do them justice in a single blog post, but I did come across several ideas from the con that stuck with me in one way or another. So...Read more

Categories: Drupal

LevelTen Interactive: Drupal Con[densed] 2016: The Best Developer Sessions (Part I)

Planet Drupal - 23 May 2016 - 10:00pm

DrupalCon New Orleans was the third DrupalCon I’ve attended, and it never ceases to amaze me how much Drupal has changed over the years, and how much time and effort the community puts in -- not just into core and contrib, but also into building out third party tools, scripts, and methods that will benefit other agencies and freelancers. It really is a privilege to be a part of a community that is so incredibly committed to the values of open source and always willing to share their experience along the way.

Aside from the ...Read more

Categories: Drupal

Commerce OpenBoleto

New Drupal Modules - 23 May 2016 - 3:51pm

Drupal Commerce payment method for OpenBoleto - http://garajau.com.br/openboleto/

Categories: Drupal

Pages

Subscribe to As If Productions aggregator - Drupal