Skip to Content

Drupal

Domain Analytics

New Drupal Modules - 17 November 2014 - 4:54pm

This project integrates separate Google Analytics IDs for each site in a Domain Access multisite.

The module adds an option on the Batch Update menu (located at Stucture -> Domain -> Batch Update ) Allowing the entry of a unique UA id for each site.

Originally written for Drupal 7 By Agentrickard. Updated to work with Domain Access 7.x-3.x.

Categories: Drupal

Forum One: The Drupal 8 Decision

Planet Drupal - 17 November 2014 - 4:20pm

From time to time, we all face big life choices. Should I attend this college? Should I take this job? Should I marry this person?

Yet few life choices loom larger for you and your organization in the next year than “When should I upgrade to Drupal 8?”

Well…perhaps the Drupal 8 decision doesn’t quite rank with the others, but for mission-driven organizations, the decision to adopt this major new release is a significant one, with implications for your digital communications for years to come. For most organizations, the upgrade represents a substantial investment that must be planned, scheduled, and budgeted.

In this article, I’ll provide a rapid overview of the promise and challenge of Drupal 8. Then, I’ll lay out the choices you are facing as a current user, or potential Drupal adopter.

The Promise of Drupal 8

Drupal 8, the first major new release in four years, represents a substantial technological departure from previous versions. (More on what constitutes a major Drupal upgrade.)

For marketers and communications professionals, there’s a lot to like. There are over 200 new features and improvements, including a mobile-first approach, in-place editing, and improved accessibility.

For technologists, Drupal 8 offers improved development techniques, as well as including improved APIs and built-in Web services. But D8 also comes with a learning curve. It has an entirely new architecture and methodology. It will take time for your developers to become comfortable with the new Symfony2 components. Drupal 8’s Object-Oriented Programming approach brings increased flexibility for those with the hardcore computer science skills necessary to exploit it.

This infographic (PDF) from the Drupal Association summarizes Drupal 8’s key features.

The Challenge of Drupal 8

One challenge for Drupal users is that the release timeline is still unknown. Certainly, we’re getting close. The beta version was released in October 2014, and it’s anticipated that it will be released sometime in 2015.

Historically, migrations from one major version to another are straightforward, but not always non-trivial. Every Drupal website is a conglomeration of the “core” Drupal software as well as typically dozens of add-on “modules” that extend or improve the software’s functionality. For example, the module that runs your fancy homepage carousel in one version may not be updated or tuned for the next version. And while Drupal 8’s upgrade process is improved, timelines and costs for Drupal upgrade projects are as varied as the websites themselves.

It’s important to realize that once Drupal 8 is released, support for previous versions will flag. If you are currently on Drupal 7, with no immediate plans for a major redesign, the issue is less pressing. But for those on earlier versions, you must be planning and budgeting for an upgrade now.

The challenge for digital communication planners depends on your existing situation. Let’s look at the possible approaches — one situation at a time.

Your Website is on Drupal 5

If you are using Drupal 5, your plan is simple. You must upgrade to Drupal 6 as soon as you possibly can.

Drupal 5 was released in 2007 and superseded by Drupal 6 a year later. If your website is running Drupal 5, it hasn’t received any security patches in four years, and is likely already compromised. It’s probably serving as jumping off point for spamming and other nefarious activities. Improving a Drupal 5 site now is difficult, and few reputable consultancies would agree to improve a Drupal 5 site without first upgrading it.

Once you are on Drupal 6, you then must consider upgrading to Drupal 7 or 8 within the next year, as described in the sections that follow.

Your Website is on Drupal 6

If your website is on Drupal 6, you need to plan for an upgrade to Drupal 7 or 8 within the next year. Once Drupal 8 is released in 2015, official support for Drupal 6 core and modules will cease within three months. This means that as security vulnerabilities are discovered, hackers are highly likely to compromise your website for their evil ends, and you will be powerless to plug the holes.

This means that Drupal 6 sites should be planning and budgeting NOW to upgrade to at least Drupal 7 in 2015. You want to be ready to move quickly once Drupal 8 is released. Three months of support is not a long time.

Your Website is on Drupal 7 (Or you are considering Drupal for Your Next Project)

If your site is currently on Drupal you can breathe easier. Drupal 7 has been out for four years, and nearly a million sites are running Drupal 7 core — far more than all previous versions combined.

It will soon be time for these sites to transition to Drupal 8, but the community will continue to support D7 until Drupal 9 is released, which is surely at least two years away.

Therefore, if you are happy with your existing website and are planning only minor improvements to the design or functionality in the near term, you can sit back and  do nothing for now. You should, of course, start planning for upgrading to Drupal 8 the next two years.

If you are currently considering building a new site on Drupal — or contemplating a major redesign in the next six months — the decision is more complicated.  You have two options.

The first option is to redesign on Drupal 7 now. That’s what thousands of projects are doing as we speak. At Forum One, every new major Drupal project currently starts with Drupal 7, and will likely continue to do so for several months following Drupal 8’s release. The software is mature, stable, widely-supported, and well understood by our staff.

The second option is to postpone your Drupal project until after Drupal 8 is released. Early adopters of D8 will get the maximum value from the new software, as their finished solution will live on Drupal for the longest period. They likely won’t need to consider a new Drupal upgrade until sometime in 2017 at the earliest. And given that the community will continue to support Drupal 8 even once Drupal 9 is released, you would be able to sleep easy knowing that your site will be able to stay patched and secure for the next four to five years.

However, at this writing, there are distinct trade-offs with waiting for D8. You are tying your project timeline to the D8 release schedule, which is community-driven and not guaranteed. Even once D8 is released, it will be a few months before skilled developers are ready to start new projects on 8. While savvy technologists are already experimenting with the D8 beta, it will take some time for modules, processes, training materials, and hosting environments to become tuned for this substantially-new platform.

Here’s another important consideration: Are you the type of product owner who can afford to be on the cutting edge? Early technology adopters typically pay more for the technology than those who follow. Later adopters benefit from the lessons of early adopters. Still, this may be an acceptable premium for your organization if Drupal 8 improves your efficiency, reduces long-term costs, or gives you a competitive advantage in achieving your goals.

Decide to Plan

Like all software, the lifespan of every major Drupal version is limited. Drupal 5 is end of life, Drupal 6 is very near end of life, and — after a good run — Drupal 7 will enter its golden years in the next twelve months.

While the Drupal 8 decision may not have the gravity of other life choices, you have an obligation to ensure that the core software for your site is, secure, stable, and well-supported.

Your most important decision is to decide to plan. Drupal 8 is coming. Are you prepared?

 

Categories: Drupal

Metal Toad: Drupal 8: First Impressions for the Back-End Developer

Planet Drupal - 17 November 2014 - 3:54pm
Drupal 8: First Impressions for the Back-End Developer Mon, 11/17/2014 - 15:54 keithdechant

Drupal 8 is in beta now, and recently I’ve had a chance to start working with it. While much of the admin interface is comparable to Drupal 7, there have been some important changes for site builders and back-end developers. In this post, I will be looking at file system and database structure changes, Drush setup, and the new configuration entity type.

Disclaimer: Drupal 8 beta 2 is not ready for production yet. If you start working with it, be warned that future beta releases might break backwards compatibility. You might need to write some code to upgrade. If this is not an option for you, you would be best served sticking with Drupal 7 until the Drupal 8 release candidate is available.

Content Types

One of the most noticeable changes to the Drupal 8 admin UI is the revised Content Type creation pages.

The “Manage Fields” page no longer contains a “widget” column. There is a new tab, “Form Display,” which allows more flexible configuration of the node add/edit form.

“Manage Fields” also no longer allows custom sorting of the fields. “Body” is always listed first, followed by the custom fields in alphabetical order. The fields can be reordered  on the “Manage Form Display” and “Manage Display” tabs.

Comments

In Drupal 8, comments are set up as a field, rather than a setting in the node type. To turn on comments for a content type, add a field of type "Comments" on the "Manage Fields" page. This is a more flexible system than in Drupal 7, allowing more than one type of comments for a single node.

This change mostly affects the admin UI. Comments are still entities in Drupal 8, and their underlying data structure is similar to Drupal 7.

Database structure

The notable changes in the database structure relate to the user profiles and the table names for field tables.

The “users” table (a single table in Drupal 7) has been split into “users” and “users_field_data” which contains the data from the built-in fields like name and password. Several other tables, including "node", "comment", and "taxonomy_term" have undergone similar structure changes. This restructuring allows for easier translations of data in the core fields.

Drupal 8 field tables now are prefixed with the type of entity they belong to. They have names like “node__field_image” or “user__field_first_name”. The data structure of these tables is similar to the Drupal 7 “field_data_*” tables, with only a few changes (e.g., the "language" column is now named "langcode").

Drush

Drush 6, commonly used with Drupal 7, is not compatible with Drupal 8. You will need to install Drush 7, which is still in development. Not to worry, it’s easy to install Drush 7 alongside Drush 6. Here is an excellent article about setting up Drush 7 with Drupal 8 using Composer: https://www.acquia.com/blog/leverage-drush-7-drupal-8

Cache and Registry

Cache and registry handling in Drupal 8 has undergone some major changes from Drupal 7. Notably, the “cache clear” command has been replaced by “cache rebuild.”

Drupal 7:
“drush cache-clear all”
(a.k.a. “drush cc all”)

Drupal 8:
"drush cache-rebuild”
(a.k.a., “drush cr”).

Note: In Drupal 8, you don't need to specify "drush cache-rebuild all." The "cache-rebuild" command appears to always clear all the caches, and any additional arguments are ignored.

Note: “drush cache-clear drush” is still used to update the list of Drush commands.

As of this writing, the “drush registry-rebuild” command does not appear to be supported for Drupal 8. This may change in the near future.

Package Management

Drupal 8 does not allow disabling of modules. The "drush pm-disable" command has been removed. To turn off a module, you need to uninstall it with "drush pm-uninstall" or by using the "Uninstall" tab on the "Extend" page in the admin UI.

As of Drupal 8 beta 2, uninstalling a module does not automatically delete the module's configuration data. However, some modules may have uninstall hooks which delete their configuration when they are uninstalled. Modules like these can no longer be uninstalled without deleting their configuration.

Package Manager bugs

As of this writing, there is a Drush 7 bug that causes an infinite loop when trying to use “drush pm-enable” (a.k.a., “drush en”) to simultaneously download and install a module:

https://github.com/drush-ops/drush/issues/5

The workaround is to download the module ("drush dl somemodule") and enable it ("drush en somemodule") in two separate steps, or to enable the module through the admin UI. This does not affect modules which you have already downloaded and wish to enable.

Compiled CSS, JS, and Twig files

In sites/default/files are several new directories:

  • sites/default/files/php - Contains compiled Twig templates
  • sites/default/files/css - Contains compiled and gzipped CSS files
  • sites/default/files/js - Contains compiled JS files

These files do not need to be added to your Git repository. Drupal will generate them automatically on page load, and they will have different file names on each machine (local dev machine, dev server, production server, etc.). Similarly, you shouldn’t try to edit these files manually because Drupal will automatically overwrite your changes at the next cache rebuild.

The Drush “cache-rebuild” command will erase these files and rebuild them.

Common errors - File permissions

Incorrect file permissions can cause PHP errors, or missing CSS or JS. Consider the following error:

Fatal error: Class '__TwigTemplate_09ab09ab7c23bd1ffe135ac9872354bdeca182f' not found in /path/to/your/site/drupal/core/lib/Drupal/Core/Template/TwigEnvironment.php on line 152

This error occurs when the web server doesn’t have permissions to write to the directory sites/default/files. Change the permissions or ownership on that directory and this error should go away.

If you encounter pages missing their CSS files, try checking the same file permissions.

Configuration Entities

Drupal 8 introduces a new type of entity, the “configuration entity.” These are represented as YAML files in the “config/install” subdirectory within a module. When the module is installed, the data from these YAML files is loaded into entries in the “config” table in the database.

The "config" table contains many of the settings that were formerly in the "system" table in Drupal 7. It also contains definitions for a number of things that were formerly in separate tables. Notable examples are Taxonomy vocabularies and text filter formats.

Config entities are only updated when the module is installed or uninstalled. Drupal does not rebuild them when you rebuild the cache. During module development, you either need to uninstall and reinstall your module, or use the config_devel contrib module to make managing your config entities easier.

Config entities are particularly useful when writing content migrations, because the migration definitions are config entities.

As of Drupal 8 beta 2, configuration entities are no longer removed when a module is uninstalled. If your custom module uses configuration entities, and you don’t want these to persist during a reinstall of the module, it might be a good idea to write an uninstall hook to remove the entities.

Example uninstall hook to remove configuration entities:

/** * Implements hook_uninstall(). * * Cleans up config entities installed by this module. */ function yourmodule_uninstall() { db_query("DELETE FROM {config} WHERE name = 'your.config.entity.name'"); drupal_flush_all_caches(); }
Categories: Drupal

Károly Négyesi: Adding comma separated username autocomplete to a D7 form

Planet Drupal - 17 November 2014 - 1:20pm

Today I needed to add autocomplete to a field that could contain comma separated usernames and obviously the requirements included autocomplete. I thought this problem must be solved already in the ecosystem and sure, Views has it already. So I have added '#autocomplete_path' => 'admin/views/ajax/autocomplete/user', '#element_validate' => array('my_module_usernames_validate') and then

<?php
function my_module_usernames_validate(&$element) {
  if ($values = drupal_explode_tags($element['#value'])) {
    // Good thing Views doesn't use the native constructor.
    $handler = new views_handler_filter_user_name();
    // And this function doesn't use the object at all.
    $handler->validate_user_strings($element, $values);
  }
}
?>

Ps. This has been confirmed as working (with a plugin instance) in D8 too.

Categories: Drupal

Address Field Via CEP

New Drupal Modules - 17 November 2014 - 11:06am

Provides address lookup and autofilling for Brazilian addresses in addressfield fields based on Via CEP webservices.

Categories: Drupal

Creative Juices: Building REST web services with Drupal 7

Planet Drupal - 17 November 2014 - 10:48am
Building REST web services with Drupal 7 Mon, 11/17/2014 - 13:48 matt
Categories: Drupal

Media Internet Text Widget

New Drupal Modules - 17 November 2014 - 9:09am

If all you want is an "embed video" URL, the media picker library widget can be overkill and can be confusing. This module allows you to just provide the media URL/Embed code field that is present on the "Web" tab of the "Media File Selector" widget.

Categories: Drupal

Crop API

New Drupal Modules - 17 November 2014 - 7:21am

Provides basic API for image cropping. This module won't do much by itself. Users should pick one of UI modules that utilize this API.

Configuration

No functionality can be tested ATM. Module is still under heavy development.
Technical details

Initial discussion can be found on manual crop issue queue.

Categories: Drupal

Drupal core announcements: Drupal core security release window on Wednesday, November 19

Planet Drupal - 16 November 2014 - 8:54pm
Start:  2014-11-19 (All day) America/New_York User group meeting Organizers:  David_Rothstein

The monthly security release window for Drupal 6 and Drupal 7 core will take place on Wednesday, November 19.

This does not mean that a Drupal core security release will necessarily take place on that date for either the Drupal 6 or Drupal 7 branches, only that you should prepare to look out for one (and be ready to update your Drupal sites in the event that the Drupal security team decides to make a release).

There will be no bug fix release on this date; the next window for a Drupal core bug fix release is Wednesday, December 3.

For more information on Drupal core release windows, see the documentation on release timing and security releases, and the discussion that led to this policy being implemented.

Categories: Drupal

Gizra.com: Behat - The Right Way

Planet Drupal - 16 November 2014 - 2:00pm

Behat is a wonderful tool for automatic testing. It allows you to write your user stories and scenarios in proper English, which is then parsed by Behat and transformed to a set of clicks or other operations that mimic a real user.

If you don't have automated tests on your project, I would argue that you're doing it wrong (I explain why on The Gizra Way presentation). Even having a single test is much better than none.

With that said, it's super easy to abuse Behat. We are developers and we think sort of like machines (not really, but you get my point). If you would like to test login to your site you could easily do

Given I visit "/user/login" # fill the username and password input fields, and click submit When I fill "username" with "foo" And I fill "password" with "bar" And I press "Login" Then I should get a "200" HTTP response

Your test will return green, but it could be improved:

Continue reading…

Categories: Drupal

Drupal Association News: Don't Miss the Blink Reaction Membership Discount

Planet Drupal - 14 November 2014 - 2:09pm

At the Drupal Association, we love our members and want to show it. That’s why we team up with some of the best Drupal companies around every month to offer our members spectacular discounts.

This month, we’re pleased to announce that  Drupal Association Members can receive 30% off Blink Institute training classes from Blink Reaction. Using the discount code here, Drupal Association members can access fantastic training from Blink, led by veteran Drupalists who are expert trainers. Note: this offer can not be combined with other promotional offers.

Blink Reaction is a premiere provider of enterprise Drupal services to Fortune 1000 companies throughout the US. Their Drupal Training program is designed to help individuals, Enterprise service providers and small business owners harness the power of Drupal.

The Blink Training program has taught beginner and advanced methods to hundreds of individuals and corporations. Blink is proud to offer free and nearly free training through Global Drupal Training Days and at Drupal Camps alongside their public and private training offerings.

Make sure you take advantage of this great opportunity while it lasts. Kudos to our friends over at Blink -- thanks for sharing the Drupal love!

Categories: Drupal

Webform UUID

New Drupal Modules - 14 November 2014 - 2:02pm

This project is a result of this thread: https://www.drupal.org/node/2076483

It is NOT the same as the Webform UUID Submission module which deals with submissions rather than the webform itself such as this module.

Categories: Drupal

Code Karate: Drupal 7 Imagefield Focus

Planet Drupal - 14 November 2014 - 1:31pm
Episode Number: 178

In this episode we look at the Imagefield Focus Module. This module adds another option to the image styles on a content type field. With this module you are able to specify a focus and crop area of your image. Once you have selected either or both of those areas the module then resizes and focuses on the certain area you specified.

Tags: DrupalFieldsDrupal 7Image HandlingDrupal PlanetUI/Design
Categories: Drupal

Feeds: Import.io

New Drupal Modules - 14 November 2014 - 12:31pm

Provides a Feeds Parser and Fetcher for import.io data sets.

Feeds: Import.io can be used for both one-off imports or a continued stream of data from import.io, a web data platform and web scraping tool.

Categories: Drupal

Bootstrap CKEditor

New Drupal Modules - 14 November 2014 - 10:46am
Categories: Drupal

Midwestern Mac, LLC: Creating a contact form programmatically in Drupal 8

Planet Drupal - 14 November 2014 - 10:24am

Drupal 8's expanded and broadly-used Entity API extends even to Contact Forms, and recently I needed to create a contact form programmatically as part of Honeypot's test suite. Normally, you can export a contact form as part of your site configuration, then when it's imported in a different site/environment, it will be set up simply and easily.

However, if you need to create a contact form programmatically (in code, dynamically), it's a rather simple affair:

First, use Drupal's ContactForm class at the top of the file so you can use the class in your code later:

Categories: Drupal

Drupal Association News: Happy Global Training Day!

Planet Drupal - 14 November 2014 - 9:39am

It's Global Training Day and we couldn't be more excited! All across the world, people are teaching and learning Drupal, and sharing that open source love.

Global Training Days happen once a quarter, and focus on one of two curriculums:

  • "Introduction to Drupal," a full day training on the basics of Drupal. Attendees will leave having successfully built a Drupal site. It is ideal for those interested in exploring Drupal as a career path.
  • "What is Drupal?" This half-day workshop will address the basics of Drupal, and will give an overview to those interested in evaluating or implementing Drupal.

Here are some of the highlights of today's Global Training Day tweets.

The first Global #Drupal Training Day Hungary is ON! @tanarurkerem and @kuszingjanos on the stage :) cc @DrupalAssoc pic.twitter.com/DGt1yvFuPg

— Zsófi M. (@zsofimajor) November 14, 2014

We are ready #drupalday!!! pic.twitter.com/ezIIl1aNHC

— Wellnet (@Wellnet) November 14, 2014

#DrupalCampMelbourne2014 Day 1 Group Photo in sunny Melbourne! pic.twitter.com/DgFh9Wcb7I

— Drupal Melbourne (@DrupalMelbourne) November 14, 2014

Where's Global Training Day happening? This map shows you where people are learning about Drupal all over the world.

Categories: Drupal

Paul Booker: How to create Blocks in Drupal 7

Planet Drupal - 14 November 2014 - 9:28am
// $Id$ /** * @file * Implements various blocks to improve pending content workflow. */ /** * Implements hook_block_info(). */ function approval_block_info() { $blocks['pending_comments'] = array( 'info' => t('Pending Comments'), 'status' => TRUE, 'region' => 'sidebar_first', 'weight' => 0, ); $blocks['unpublished_nodes'] = array( 'info' => t('Unpublished Nodes'), 'status' => TRUE, 'region' => 'sidebar_first', 'weight' => 0, ); return $blocks; } /** * Implements hook_block_configure(). */ function approval_block_configure($delta) { $form = array(); switch($delta) { case 'pending_comments': $form['pending_comment_count'] = array( '#type' => 'textfield', '#title' => t('Configure Number of Comments to Display'), '#size' => 6, '#description' => t('Enter the number of pending comments that will appear in the block.'), '#default_value' => variable_get('pending_comment_count', 5), ); break; case 'unpublished_nodes': $form['unpublished_node_count'] = array( '#type' => 'textfield', '#title' => t('Configure Number of Nodes to Display'), '#size' => 6, '#description' => t('Enter the number of unpublished nodes that will appear in the block.'), '#default_value' => variable_get('unpublished_node_count', 5), ); break; } return $form; } /** * Implements hook_block_save(). */ function approval_block_save($delta = '', $edit = array()) { switch($delta) { case 'pending_comments': variable_set('pending_comment_count', (int)$edit['pending_comment_count']); break; case 'unpublished_nodes': variable_set('unpublished_node_count', (int)$edit['unpublished_node_count']); break; } return; } /** * Implements hook_block_view(). */ function approval_block_view($delta = '') { switch ($delta) { case 'pending_comments': $block['subject'] = t('Pending Comments'); $block['content'] = approval_block_contents($delta); return $block; break; case 'unpublished_nodes': $block['subject'] = t('Unpublished Nodes'); $block['content'] = approval_block_contents($delta); return $block; break; } } /** * A module-defined block content function. */ function approval_block_contents($delta) { switch ($delta) { case 'pending_comments': if (user_access('administer comments')) { $nbr_comments = variable_get('pending_comment_count'); $result = db_query("SELECT cid, subject FROM {comment} WHERE status = 0 limit $nbr_comments"); $items = array(); foreach ($result as $row) { $items[] = l($row->subject, 'comment/'.$row->cid.'/edit'); } return array('#markup' => theme('item_list', array('items' => $items))); } break; case 'unpublished_nodes': if (user_access('administer nodes')) { $nbr_nodes = variable_get('unpublished_node_count'); $result = db_query("SELECT nid, title FROM {node} WHERE status = 0 limit $nbr_nodes"); $items = array(); foreach ($result as $row) { $items[] = l($row->title, 'node/'.$row->nid.'/edit'); } return array('#markup' => theme('item_list', array('items' => $items))); } break; } } Tags: URL: paulbooker / gist:5420976
Categories: Drupal

Bootstrap Frontend Experience

New Drupal Modules - 14 November 2014 - 8:35am
Categories: Drupal

Paul Booker: How to create an autocomplete form element in Drupal 7

Planet Drupal - 14 November 2014 - 8:22am
<?php function demo_menu() { $items['demo-autocomplete-test'] = array( 'title' => 'Test autocomplete', 'page callback' => 'drupal_get_form', 'page arguments' => array('demo_form'), 'access arguments' => array('view published content'), 'type' => MENU_NORMAL_ITEM, ); $items['demo-autocomplete-engine'] = array( 'page callback' => 'demo_autocomplete', 'access arguments' => array('view published content'), 'type' => MENU_CALLBACK, ); return $items; } function demo_form($form, &$form_state) { $form = array(); $form['colors'] = array( '#title' => t('Colors'), '#type' => 'textfield', '#maxlength' => 60, '#autocomplete_path' => 'demo-autocomplete-engine', ); $form['submit'] = array( '#type' => 'submit', '#value' => 'Submit', ); return $form; } function demo_autocomplete($text) { $results = array(); $query = db_select('colors', 'c'); $query ->condition('c.color', '%' . db_like($text) . '%', 'LIKE') ->fields('c', array('color')) ->orderBy('color', 'ASC'); $colors = $query->execute(); foreach ($colors as $row) { $results[$row->color] = check_plain($row->color); } drupal_json_output($results); } Tags:
Categories: Drupal
Syndicate content


Google+
about seo