Planet Drupal

Subscribe to Planet Drupal feed
Drupal.org - aggregated feeds in category Planet Drupal
Updated: 28 min 43 sec ago

OSTraining: Should I Use Context or Panels for Drupal Sites?

Tue, 20/10/2015 - 23:22

There are multiple different ways to design a Drupal site. You can code your theme, or you can use modules such as Panels, Context and Display Suite.

I'm reluctant to answer the question of which solution is "best", but we do often get asked about which approach Drupal site-builders should use.

In this video, Robert Ring compares Context and Panels, explaining different situations in which he'd choose to use each module. If you want to learn more, we have full classes on Contextand Panels.

Categories: Elsewhere

OpenConcept: Updating Google Analytics In Drupal

Tue, 20/10/2015 - 23:16
Foreword:

   Google Analytics is a great tool to see where people are browsing on your site, to monitor traffic, and possibly some other perks I'm unaware of.  ;)  So it's important to make sure it still works when you're upgrading the Google Analytics Tracking ID and updating the Google Analytics module, or just updating the module.

   Why would you want to do that?  Well: The 1.x branch of the Google Analytics module is now no longer supported, so if you want security updates you'll have to update to the 2.x branch (pretty straight-forward).

   If you're reading this post, you're likely about to attempt updating this module.  I had a hard time finding all this information, so I'm sharing it in a blog post in case anyone else might benefit.

   Important:  If you have a Google Analytics Classic Tracking ID it needs to be upgraded to the newer Universal Tracking ID in order to work with the 2.x branch of the Google Analytics module.

 

Run-down:
  • Determine Tracking ID type
  • Upgrade Tracking ID if needed
  • Ensure Tracking ID in module config matches one in Google Analytics account
  • Update Google Analytics module
  • Update Google Analytics Tokenzier module if necessary
  • Check that your site is reporting to Google Analytics

 

Walk-through:

   Start with the Tracking ID and find out whether or not yours is the Classic version or the Universal version.

   Once you log into Google Analytics, click on the "Admin" link in the top menu.  This is what Universal Google Analytics looks like:

   If you don't see that, you'll see something below the Property drop-down indicating that your Universal Analytics Upgrade transfer has not started, much like this:

   To begin upgrading to the Universal Tracking ID, click "Universal Analytics Upgrade".

   Once you've either upgraded or determined that your Tracking ID is Universal, make sure the Tracking ID in your Analytics account matches the Web Property ID in your Google Analytics module settings.  Drupal 7: /admin/config/system/googleanalytics.  Drupal 6: /admin/settings/googleanalytics.  This is at the top of the page.

   Now you can update the Google Ananlytics module.  Since there will be a decent amount of database updates, it would be a good idea to put the site into maintenance mode.  If you use Google Analytics Tokenzier, update that as well.  Explanation: Older versions of Google Analytics Tokenizer, when used with the 2.x branch of Google Analytics, use a function with deprecated PHP that will cause a WSOD.  No passing GO.  Right to white.

   Last, but not least:  Make sure your site is reporting to Google Analytics.  Once logged into Google Analytics you'll see a list which will contain a name representing your site.  Like so:

   Once you click on your site, you should see a menu to the left and content to the right.  When you click on "Real Time", it should expand a list.  Then you can click on "Content" to see a real time update of who's looking at what, which updates in a matter of seconds.  It will look much like this:

   When you scroll down the right-hand side you will see a list of pages on your site that people are currently browsing, which will show up almost instantly when you click around your own site.  Choose a page that isn't already in that list so it's easier to tell.

   If your site isn't reporting, double-check that your Tracking ID matches the Web Property ID in the Google Analytics module config and check the recent log messages to see if anything is interfering.

Topic: 
Categories: Elsewhere

Last Call Media: Baltimore Drupal Camp 2015

Tue, 20/10/2015 - 22:40
Categories: Elsewhere

Web Wash: Build a Blog in Drupal 8: Managing Blocks

Tue, 20/10/2015 - 22:26

The Block system in Drupal allows you to add arbitrary content into regions within a theme. A block could be as simple as just text or list content using Views.

In Drupal 7, the Block system is pretty limiting. For instance, a single block can only be assigned to a single region. You also have very basic control of hiding and displaying blocks.

To handle these short comings in Drupal 7 you would use Panels for complex layouts and Bean so you can add fields to blocks.

In Drupal 8, the Block system has been revamped and it's more flexible. The two big improvements: assign a single block to multiple regions and fieldable block types.

In this tutorial, we'll continue work on our Drupal 8 blog site. We'll add a static call-to-action which'll only appear in the sidebar on the blog page. This call-to-action could be some promotional content or a newsletter sign-up form.

Then we'll create a custom block type which we'll use to create reusable promotional content that can be added to any blog post.

Categories: Elsewhere

Evolving Web: Node smuggling, aka poor man's node_export

Tue, 20/10/2015 - 21:09

I needed to create a new webform on a production site recently. But as a dev, I don't have direct access to the production admin backend; I'm only allowed to push code changes and let the client's team migrate them to prod via drush updb. So I'm supposed to export the webform configuration to code, and deploy it via an update hook, but how?

read more
Categories: Elsewhere

Aten Design Group: Drupal 8: Programatically Adding a Views Footer

Tue, 20/10/2015 - 20:00

Recently, I needed to add some dynamic content to a Views footer. Specifically, I needed to change a link in the Views footer based on the current path, which isn’t an option from the Views UI. I found some good documentation showing how this can be done in older versions of Drupal (https://www.drupal.org/node/749452), but nothing for Drupal 8. I figured the approach must be similar in Drupal 8 so I started searching and reverse engineering.

First, I added a footer directly through the Views UI and exported my sites configuration using Drupal 8’s configuration management tools. Finding the footer in the exported YAML file provided some valuable insight on how I might add the footer programmatically.

Views Footer as found in the YAML export: footer: area_text_custom: id: area_text_custom table: views field: area_text_custom relationship: none group_type: group admin_label: '' empty: false tokenize: false content: Footer content is great plugin_id: text_custom

The YAML Views export provided the settings I needed to add the footer, but I also needed to figure out the right place to do it in code. If you are familiar with Views hooks, then you know there are a ton of them and sometimes finding the right one to use is a bit of trial and error. Since some of the Drupal 7 examples I found used function hook_views_pre_view(), I started with that hook. Using the Devel module, a great option for debugging in Drupal, and its dpm() function, I inspected the $view object. In Drupal 8, dpm() shows the available methods for an object. With a little bit of guesswork, the setHandler method seemed like the correct choice.

Output from the dpm() function.

I was able to add a Views footer with some code in a custom module: use Drupal\views\ViewExecutable; function YOURMODULENAME_views_pre_view(ViewExecutable $view, $display_id, array &$args) { if ($view->id() == 'view_machine_name' && $display_id === 'view_display') { $options = array( 'id' => 'area_text_custom', 'table' => 'views', 'field' => 'area_text_custom', 'relationship' => 'none', 'group_type' => 'none', 'admin_label' => '', 'empty' => TRUE, 'tokenize' => FALSE, 'content' => ‘Footer content is great.’, 'plugin_id' => 'text_custom', ); $view->setHandler('view_display', 'footer', 'area_text_custom', $options); } }

One piece of the Drupal 8 Views module has been solved!

Categories: Elsewhere

David Lohmeyer's Blog: How to make custom Guzzle requests in Drupal 8 modules

Tue, 20/10/2015 - 19:27

If you're sending a request to a custom URL in Drupal 8, you might be tempted to implement a solution using cURL or another library. However, Drupal core comes with Guzzle, a "PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services." As with most things in Drupal, it's not obvious how to use something immediately, so here's a demo to show you how to take care of sending a request to an arbitrary URL inside a custom Drupal module. You might use this example class to display a status code on some page.

Categories: Elsewhere

Acquia Developer Center Blog: Creating Adaptable Content with Drupal 8

Tue, 20/10/2015 - 19:25

Not long ago, the only way content was delivered to you from the Web was via Web pages. You typed something into a browser and a server returned a page of information.

This singular method, however, has become outdated and no longer represents all the ways you and your applications are accessing content from the Web.

Tags: acquia drupal planet
Categories: Elsewhere

Drupal Association News: Cathy Theys: Innaugural Aaron Winborn Award Winner

Tue, 20/10/2015 - 19:10

Earlier this year the Drupal community lost one of our most porlific community members, Aaron Winborn. In addition to the code that Aaron contributed, he was a friend to everyone he met in the Drupal community. Aaron was the epitome of our unoffical motto: "Come for the code, stay for the community." To honor Aaron's memory, the Community Working Group, with the support of the Drupal Association, established the Aaron Winborn Award, to be given annually.

The Community Working Group accepted nominations over the spring and summer, with community members nominating dozens of their colleagues who represent the integrity, kindness and commitment to the Drupal community that Aaron did. From these nominations, the Community Working Group members and Hans Riemenschneider (who originated the idea) selected our innaugural winner: Cathy Theys

It's hard to imagine that there is anyone in the community who has not crossed paths with Cathy. She has been a champion for new contributors for as long as I have been part of Drupal, hosting office hours in IRC and helping to coordinate mentors at every DrupalCon sprint and beyond. She has personally sat by my side and used the socratic method to talk me through Git commands. She is a model of generosity and curiosity, and is a tremendous asset to the Drupal Community.

Cathy's reward is a scholarship and stipend to attend DrupalCon next year, as well as a very lovely Drupal trophy. We got the the chance to celebrate Cathy's award on stage at DrupalCon Barcelona, but I hope you will join me in congratulating her again now.

Categories: Elsewhere

Drupal Watchdog: Content Workflow Basics in Drupal 7

Tue, 20/10/2015 - 18:07
Article

Organizations of all types need the ability for individuals and teams to be able to create new online content and modify existing content, submit those changes for approval, approve or disapprove that work, and ensure that all the participants in the workflow can see the status of each piece of content in the system and be promptly notified if they must act upon it, to keep the process flowing smoothly. Drupal 7 is ideally suited as a framework for building a website that can support such a workflow setup – with numerous pertinent modules that operate well together.

We will examine some key modules for building this sort of website, as well as how to configure them and set permissions for some basic types of roles invariably employed in such workflows. Our goal is to set up the system so that the mechanics of the workflow are as automated as possible, but with a minimum of complexity.

The Usual Suspects

There are innumerable core and contributed modules that can be employed for crafting an effective workflow, and they tend to be grouped into three categories corresponding to different strategies for implementing whatever type of workflow is desired: Revisioning, Workbench Moderation, and the venerable Workflow.

Choosing one strategy does not preclude using modules geared toward another strategy. Here we will be using the Workflow approach, but it is good to be aware of the Revisioning module – which allows permitted users to create, moderate, and publish content revisions – and Workbench Moderation – a popular alternative which permits moderation down to the revision level.

For any basic content editing and publication system, the following modules can be utilized in some combination:

Categories: Elsewhere

Tim Millwood: Deploy: How it'll work in D8

Tue, 20/10/2015 - 17:40
Over the last 7+ years working with Drupal, one question always asked by clients is, how do I copy...
Categories: Elsewhere

Pages