Planet Drupal

Subscribe to flux Planet Drupal - aggregated feeds in category Planet Drupal
Mis à jour : il y a 13 min 21 sec

Drupalize.Me: New Tutorials: Manage Drupal Sites with Pantheon

mer, 19/08/2015 - 15:30

Today we are happy to present a new series teaching you how to Manage Drupal Sites with Pantheon, which is completely free thanks to the generous sponsorship of Pantheon. Pantheon is a great service for management your website development and launching your sites on an environment that has been optimized for Drupal.

Catégories: Elsewhere

Zyxware Technologies: [Drupal] What is the usage of drupal_write_record function in Drupal 7?

mer, 19/08/2015 - 13:39

The drupal_write_record function is used to insert or update a record in the database based on the schema of the table. It helps in executing less database query. Let's take a look at the function given below.

DrupalDrupal 7Drupal Planet
Catégories: Elsewhere

Realityloop: Testing, Testing, 1, 0, 1

mer, 19/08/2015 - 10:04
19 Aug Stuart Clark

At Realityloop I've been involved with some extremely complex site builds, varying from Commerce driven paywalls to fully fledged data reporting web applications. Yet, the hardest thing I've ever had to do is successfully sell automated testing to a client.

And the reason for that is relatively simple; Tests are hard to write, therefore time consuming and expensive.

However this is a misconception, while certain types of tests can be hard to write, any automated tests will recoup the costs in a short amount of time, and as such, you can’t afford not to have tests.

In part one of this post I will be explaining exactly why you need tests. In part two (due in three weeks) I will cover how to get started and implement your automated tests.


What are tests?

A test is exactly what it sounds like; a method to ensure that your project behaves as is expected.

Any steps taken by an individual to ensure the project is behaving correctly are considered to be manual tests, and while they are essential, they are time consuming.

For an example of what a test may be, let's look at the following scenario:

Fictitious Inc want a contact form on their website that will send emails to specific recipients based on the type of enquiry.

They need three enquiry types:

  1. Support to

  2. Sales to

  3. General enquiry to

Along with this requirement, they also wish to have a personalised auto-response per enquiry type.

Once this the above functionality has been created, all parties, at some point, will need to ensure that it does indeed work as expected.

This process is your manual test, which would look something like this:

Jarkko navigates to his Fictitious Inc. development site, clicks on the Contact menu item, selects the Support enquiry type, fills out some dummy data and submits the form.

He then ensures that the email was sent to the correct email address with the supplied data, and ensures that received the correct auto-response with the correct personalisations given the supplied data.

Lastly, he repeats the process with the other two enquiry types, ensuring that he supplies different data to his previous test(s).

That’s a test, and a relatively simple test, but already it's evident that it is time consuming. Throw in more complexity to the requirements and the time increases exponentially.

Any future work on this project, regardless of the area of work, should ensure that these same tests, as well as any other tests in the site, are run again. Otherwise you run the risk of accidentally breaking a core feature of the project.

As such, manual testing becomes excessively time consuming, and often a step that is skipped by all involved.

Automated testing is the answer.


What are automated tests?

There are various types of automated testing, but for the sake of this post I will be concentrating on "integration tests".

An automated test is, again, exactly what it sounds like; an automated method to ensure that your project behaves as is expected.

Take the previous scenario, currently each individual involved in the project (developer, tester, project manager, client, etc) could be spending anywhere between 2 and 10 minutes to manually test that small subset of the project functionality every time any changes are made to the project.

Automated, the same test should take no more than a 30 seconds in total, and can be run along with all other automated tests in one quick hit.


Manual testing vs Automated testing

In the above video you can see the Automated test running side-by-side with the Manual test.

The Automated tests are not only testing the same scenario as my Manual tests, but also installing a fresh copy of Drupal, enabling all required modules, flushing caches, reverting features and running a few additional checks that I didn't do in the Manual test.

For those of you who do not wish to watch the video, the results are as such:

Manual testing - 3 minutes 19 seconds

Automated testing - 27 seconds

However, there is still a time investment involved to create the tests. In this case it took me roughly 60 minutes to write the tests, in which time the manual tests could have been run about 18 times, assuming of course your manual tester doesn't decrease efficiency after running each test.



Continuous Integration

With the above simpletest, the responsibility of running the tests is still in the hands of a human, and as such you will only get your test results if someone bothers to run the tests.

Continuous integration relieves your human workers of that responsibility, instead automating the running of the automated tests.

Travis CI is one such service which is relatively well loved by the open source community due to the direct integration with Github.

Along with the benefit of running automated tests on every commit (or tag, if that is how you wish to configure it), Travis can run multiple testing jobs concurrently, allowing you to ensure you project works on a variety of different environments.

Travis CI jobs do take longer than running a Simpletest (based on my above video), which is due to Travis not only doing all the additional things that Simpletest is doing but also having to setup a complete environment prior to installing Drupal. However, as you can run potentially upwards of 10 concurrent jobs (on a Premium plan) this time loss is quickly negated.

Assuming you are on a free plan, and the current load on the server allows for 4 concurrent jobs taking a maximum of 1 minute and 20 seconds (the average from my own tests), you recoup the cost of the test development in only 4 commits.

Adding Travis integration to your Drupal project is relatively simple thanks to the Drupal Travis Integration project. It’s as simple as adding and configuring single file to your Github repository. However I’ll go into more detail on this in part 2 of this post.

drupaldrupal planet
Catégories: Elsewhere

KnackForge: Drupal 6 Re-initializing Gmap in Jquery

mer, 19/08/2015 - 08:15
Assume, I am able to print the gmap using Drupal code in a div. I would like this map to appear inside a fancybox and to be hidden on the website. I've managed to do it (fancybox works ok) however the map is not displayed correctly, I am getting "Javascript is required to view this map".   Here is an *experimental* method, that may allow you to successfully reboot a map.  
  1. // Init Fancybox
Catégories: Elsewhere

KnackForge: How to deal with hover on touch screen devices

mer, 19/08/2015 - 07:27
Links with hover styles on touch devices are a bit of a complication. In short, they don’t really exist on these devices. Creating fancy :hover styles can really add to the browser experience and help simplify your layout, but they simply will not work on a touch device. When a tablet or smartphone user taps your hover-styled link elements, the hover style shortly appears, and immediately the underlying link is followed/activated.   So how do we handle this problem? Do we sniff out touch devices and disable hover classes? Not at all: it can be fixed using jQuery, and with some minimal adjustments you can keep using your hover styles across all browsing devices   THE GOAL   When a touch user taps menu A, only the hover style for menu A is activated but the link does not open. After this, there are two possible options:   1. User taps menu A again -> menu A is opened. 2. User taps menu B -> mouseover for menu B is activated and the hover style for menu A is deactivated.   Another thing to keep in mind is that if a user taps menu A, then taps menu B and then taps menu A again, it should not consider menu A as being tapped for a second time (which would lead to the browser to open the link).   WHAT WE NEED TO ACCOMPLISH   To realize our goal, we need to accomplish the following using (jQuery)  
Catégories: Elsewhere

KnackForge: Configure SOLR for Spatial Search Setup

mer, 19/08/2015 - 07:18
Configure SOLR for Spatial Search Setup ----------------------------------------------------   One of our projects requires the spatial search to find the closest records for given address OR zipcodes. So we decided to use SOLR for performing spaital search based on latitude & longitude for getting the closest records.   This blog describes on SOLR configuration for location based spatial search and how to run queries on SOLR.   You can download latest SOLR from here :   Schema Changes :   To add location data (latitude, longitude) in documents, we need to update the schema.xml file. We need to add a new field type (specifically used for geospatial searching). In case it's not already present (depends on SOLR version), we have to add the below fieldType definition to the schema.xml file.   <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>   FieldType definition is done. Now we need to define the fields for location data.   <field name="latlon" type="location" indexed="true"  stored="true" />   indexed=true makes a field searchable (and sortable and facetable). For eg, if you have a field named test1 with indexed=true, then you can search it like q=test1:foo, where foo is the value you are searching for.   stored=true means you can retrieve the field when you search.   Indexing Location Data  
Catégories: Elsewhere

Modules Unraveled: 145 Project Workflow and Drupal Issue Queues with Joshua Mitchell - Modules Unraveled Podcast

mer, 19/08/2015 - 07:00
Published: Wed, 08/19/15Download this
  • Prioritizing work on Roadmap
    • Unblock Drupal 8
      • DrupalCI - testing infrastruture for Drupal code
      • upgrade to D7
    • Improve search
    • Implement new documentation section and tools
  • Two Factor Authentication
  • Issue Credits
  • Funding work
    • D8Accelerate
    • Ongoing Funding
Work that is coming later Questions from Twitter
  • hussainweb
    I think a hierarchical menu system has it's place - Gives a continuity and mark progress if you want to read a topic. #MUP145
  • hussainweb
    Can you attribute different patches in a single issue - some to the organization and some as a volunteer? #MUP145
  • hussainweb
    Some issues get abandoned after some work. Is that never counted? #MUP145
  • Paulius Pazdrazdys
    How much forums are being used? Maby you are thinking to more question -> answer model as stackoverflow has? #MUP145 (Issue about the subject - Petition to move forums to Stack Exchange)
Episode Links: Josh on drupal.orgJosh on TwitterTags: drupal.orgplanet-drupal
Catégories: Elsewhere

KnackForge: Translation in Drupal 7 : How it works?

mer, 19/08/2015 - 06:28

As we all know that, we were all getting projects and clients across the globe. But doing a multilingual website with each having different set of requirements make the website handling tougher and tougher. Also, building a multilingual web site involves much more than translating content from one language to another. Translation must be done with an awareness of a language's idioms as spoken within a geographic region. But in Drupal we’ve been provided with rich set of core and contrib modules, which supports translation for our website(s). When we go deeper in the concept of Drupal Translation, there is a lot more can be learnt. Well, here I explain you a few concepts that i’ve come across.

The Translation Methods:

In Drupal 7, we have two different types of translation methods, which we can call as two main modules to implement translation of content in order to make a site multilingual. One is Entity Translation (contrib) and the other one is Content Translation (core).

  1. Content Translation

    1. a core Drupal module that allows you to translate nodes.

    2. Translated nodes are mapped together, but if they are distinct nodes that can be treated separately.

  1. Entity Translation

    1. Translation module lets you translate particular fields, while only a single node or entity is created.

Catégories: Elsewhere

KnackForge: Add placeholder, Alter or hide image captcha title

mer, 19/08/2015 - 06:17

To add placeholder or alter the title, description and hide of the image captcha, do as follows

Use hook_form_FORM_ID_alter() and Form API pre_render function.


/** * Implements hook_form_FORM_ID_alter() */ function MY_MODULE_OR_THEME_form_contact_site_form_alter(&$form, &$form_state, $form_id) { $form['#pre_render'][] = 'yourform_pre_render'; } function yourform_pre_render($element) {   if (isset($element['captcha']['captcha_widgets']['captcha_response']['#title'])) {     // change title $element['captcha']['captcha_widgets']['captcha_response']['#title'] = t('Change title name');  // placeholder add $element['captcha']['captcha_widgets']['captcha_response']['#attributes']['placeholder'] = $element['captcha']['captcha_widgets']['captcha_response']['#title'];  // empty title $element['captcha']['captcha_widgets']['captcha_response']['#title'] = ''; $element['my_captcha_element']['captcha_widgets']['captcha_response']['#description'] = "New Description"; } return $element; }

You can also use hook_form_alter() function:

Catégories: Elsewhere

Colan Schwartz: Get search results for compound words not in content with Drupal, Search API and Solr

mer, 19/08/2015 - 01:01

It is possible to expand compound search terms to multi-term synonyms. That is, if your Drupal site content contains text such as "dark room" or "key note", and you don't want your users to get No results pages on searches for "darkroom" or "keynote" (respectively), you'll need to do a bit of extra work to make this happen.

Let's assume we've got a Drupal 7 site working alongside Solr to provide the advanced back-end search functionality, and the Search API plus Search API Solr Search modules to integrate the two systems. At the time of this writing, this is a widely used best-practice approach. However, it doesn't natively support the above use case.

Some potential options for setting this up include spellchecking and fuzzy searching. But Solr itself already supports the use of synonyms even though the Search API does not. So let's tweak Search API's set-up to work with it.

There are several steps required to make this happen.
  1. If you're got the tokenizer enabled on your search index, disable it by unchecking the box over at Administration » Configuration » Search and metadata » Search API » Your index name » Filters » Processors » Tokenizer, and then save the configuration. If the Tokenizer option is enabled, it will prevent the synonym functionality from kicking in.
  2. Modify the Solr configuration in your search collection over at /path/to/solr/collection-name/conf/schema.xml around line 162.
    • Before:         <!-- in this example, we will only use synonyms at query time
              <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
    • After:         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
  3. Define multi-term synonyms in the synonyms.txt file that's in the same folder as the above schema.xml file. Follow the form here.
    • darkroom => dark room
    • keynote => key note
  4. Restart the search engine. This is system dependent, but if you're using the GlassFish application server for example, you may be able to restart Solr with a command like sudo service GlassFish_solr restart.
  5. Clear the search index and rebuild it.
    1. Surf to Administration » Configuration » Search and metadata » Search API » Your index name.
    2. Hit the "Queue all items for reindexing" button.
    3. Hit the "Index now" button.

That should do it. You're all set!

Background reading For more information on how all of this really works, here are some useful articles on the subject.

This article, Get search results for compound words not in content with Drupal, Search API and Solr, appeared first on the Colan Schwartz Consulting Services blog.

Catégories: Elsewhere

Shitiz Gag's Blog: [GSoC 2015: Hawk Authentication] Week 13: Final weeks

mar, 18/08/2015 - 20:21

GSoC is coming to a close, so these few weeks have been mostly about wrapping things up. This is good for me as well because college has taken a toll so I have less and less time to spend, but I believe I have enough to have the module at a good position before GSoC closes.


WWW-Authenticate is a HTTP header which is used to identify which protocols the server supports. If a server supports multiple WWW-Authenticate headers, it can send it multiple times to identify different protocols. For example: Drupal can send WWW-Authenticate: Hawk and WWW-Authenticate: Basic for identifying that it supports Hawk and Basic Auth. However, Drupal at the moment doesn’t have support for gathering and sending multiple header values from different modules due to the way it handles 401 Authentication Required exception. I will be working on allowing multiple protocols to send WWW-Authenticate so that multiple auth protocols can be identified at the same time.

Testing Hawk and Basic Auth together

I also spent a considerable amount testing these two protocols together, here is a summary of my findings but in summary: Both protocols work well individually but if a client sends requests containing both protocol’s headers at the same time it would cause either to fail due to the way HTTP protocol dictates concatenation of header values. HTTP recommends allowing only a single protocol in one request in order to have fewer points of failure so for the moment I believe this behaviour is fine, however if it is deemed beneficial to allow multiple protocols within same request it is always a possibility.

For now that is all, I’ll be dealing with WWW-Authenticate issue and documentation during my last week of GSoC.

Thank you for reading!

Catégories: Elsewhere

Drupal for Government: Virginia Physician API and Data Mining

mar, 18/08/2015 - 18:54

So recently we discovered and since we're looking to help people in Charlottesville I've added the data (thanks to feeds) and we added a couple of data mining points (using open layers)for the maps and h

Catégories: Elsewhere

benamer: Check out the Chartbeat Most Popular module

mar, 18/08/2015 - 18:30

You know those lists on a web site that you see from time to time listing the currently Most Popular articles on the site? I have to admit that I click on them from time to time to understand what is popular and why. It's a clear case of herd reading. Well, Drupal has a new module to create a Most Popular list on your site based on the Chartbeat Analytics API and it's written by myself and Darryl Norris. It's available on 

Catégories: Elsewhere

Acquia Developer Center Blog: Avoiding Fuzzy Math When Load Testing

mar, 18/08/2015 - 17:42

No one likes fuzzy math. It’s especially problematic when you’re conducting a load test and can’t accurately gauge concurrency.

In this last blog of a series on load testing, here are some tips on how to avoid the fuzzy math that can distort your expectations of how a website will perform.

Shaky math can happen when using Apache JMeter, which is the most commonly used application to load test the performance of an open source site.

JMeter breaks it down into three categories: the number of threads that are happening at once, the ramp-up period from zero requests at a time to the max number, and the number of iterations. This typically is the way to determine expected concurrency: the total number of requests divided by average response times over how long you test.

There’s a problem with this method, though. When a site becomes overwhelmed, the response time actually increases, which means concurrency drops. So with such a test, you’re actually simulating the exact opposite of a normal site and not even close to seeing probable concurrency.

But there is a proper way to solve this, a way to get a true glimpse of possible concurrency – it’s something called throughput shaping. You can find it on With this tool, you only have to simply say, “I want a thousand requests at once,” and it’s not only accurate but will save time that’s ordinarily lost on JMeter as you first try to figure out things like how many requests will hit your site at once.

Another speed bump to consider is how difficult it’s becoming to properly determine how many requests hit your site. That’s because not every every bot and not all of the “noise” on the Web crosses the path of Google Analytics and Omniture. Likewise, looking at the number of requests to your Web servers on Acquia Cloud, for example, doesn’t take into account if you’re using a CDM. (But if you are using a CDM, that’s the most likely source where you’ll have an accurate number.)

So here’s the last lesson of this series: Don’t extrapolate results. If you’re testing with 150 connections, don’t assume 300 will be exactly twice the number of resources required. Your test will tell you what 150 did. Load testing should be conducted in an environment that’s exactly the same size as what your production environment will be. Sure, it will cost a bit, but it will tell you how things will actually behave.

If your site faces contention – when many visitors simultaneously compete for your application’s attention – it will perform the exact same way if you have 150, 300 or even 600 connections. But the point is, you don’t actually know that; extrapolating results won’t provide an accurate number. Most often people look at the numbers, testing exactly to the numbers they have today. They’re missing more than just surges.

Consider must-visit websites for special events like sporting events and live award shows. They have one or two huge days of traffic a year, but the rest of the year, they’ll have a totally different number of visitors. So, when load testing, it’s not just a matter of looking at numbers. It’s understanding what those numbers actually mean and recognizing your end goal.

I recommend that once you have numbers, always test about 50% above that. Not necessarily because you’ll see that kind of traffic at launch, but if the site’s successful and growing over time, it’s rare that you’ll take the time to go back and run more load tests. By initially testing well above what you’re expecting, you’ll have a buffer and won’t have to worry about how the site is going to behave six months from now.

Hopefully this series has prompted you to think carefully about the nuances of load testing and will help as you prepare to launch a site. Load testing done right can help achieve optimal site performance. And, as I mentioned earlier in the series, your users define where load testing should take place, so you can’t go wrong. If you have any questions or suggestions, please drop a note in the comment box. Thanks for reading.

Blog series: Load Testing Your Drupal WebsiteWorkflow: PendingFeatured: NoTags: acquia drupal planetDrupal 8 related: NoAuthor: Erik Webb
Catégories: Elsewhere

Mediacurrent: Accessible Names - Label All the Things! (Part 1)

mar, 18/08/2015 - 17:24

The more we label things when building a website, the easier it is for a person who is blind and uses a screen reader to use our sites. These labels are known as the “accessible name properties” and they are baked into HTML.  

Catégories: Elsewhere

Imagine Creativity: <a href="/blog/what-drupal-intro-drupal-workshops-global-training-day">What is Drupal &amp; Intro to Drupal workshops - Global Training Day</a>

mar, 18/08/2015 - 17:16

We are happy to announce that we are running Drupal training sessions this month as part of the Global Training Days. The initiative is run by the Drupal Association to introduce new and beginner users to Drupal.

Come and join us on Friday 21st August to learn about what Drupal does and how it can help you. We will discuss the software and show you examples of it in action.

What is a Drupal Global Training Day?

Drupal Global Training Days is a worldwide initiative to increase the adoption of Drupal. All across the world, people are teaching and learning Drupal, and sharing that open source love.

Catégories: Elsewhere

Imagine Creativity: <a href="/blog/drupalaton-2015-our-perspective">Drupalaton 2015 : our perspective</a>

mar, 18/08/2015 - 17:16

Last week we attended Drupalaton for the second year in a row. It was so valuable to us last year we couldn’t resist returning, especially after attending the great events Drupalaton & Drupal Dev Days Szeged last year. See our blog post from last year Drupalaton 2014.

Catégories: Elsewhere

Imagine Creativity: <a href="/blog/drupal-camp-north-why-we-loved-it">Drupal Camp North : Why we loved it</a>

mar, 18/08/2015 - 17:16

This weekend we were very pleased to be able to attend the first Drupal Camp North in Sunderland. The great event took place at Sunderland Software Centre and was made possible thanks to them and Make It Sunderland.

Catégories: Elsewhere

Imagine Creativity: <a href="/blog/come-join-us-drupal-camp-london-2015">Come join us at Drupal Camp London 2015</a>

mar, 18/08/2015 - 17:16

There are only 3 weeks left until Drupal Camp London​ takes place (Fri 27 February - Sun 1 March). It will be hosted by City University London​ in Angel as it has for the past 2 years.

Whether you're a Drupal​ pro or just want to learn more, follow the link for weekend, business day and volunteer tickets.

Session submissions have now closed and are being selected for the schedule. In the meantime feel free to look at last year's site for an idea of what is on offer Drupal Camp London 2014

Drupal Camp London 2015


Catégories: Elsewhere

Imagine Creativity: <a href="/blog/drupalaton-2014-hungary-largest-lake-central-europe">Drupalaton 2014 in Hungary, at the largest lake in Central Europe</a>

mar, 18/08/2015 - 17:16

Wow my Hungarian friends - you have done it again! Two weeks ago, I spent a long weekend at Drupalaton, a Drupal camp in Hungary with the difference that it also served as a short relaxing break. It was the perfect combination of a holiday and work with the beautiful surroundings of Central Europe’s largest lake Balaton.

I was very excited to return to the country after the amazing Drupal Developer Days in Szeged event that I went to in March. It was also filled with meeting amazing people from all around the world, learning and sharing knowledge and connecting with so many inspiring people.

Catégories: Elsewhere