Drupal
Lullabot: Learning Sass and Compass
More and more projects today are using CSS preprocessors, with Sass being one of the most popular out there. What exactly is a CSS preprocessor? It is a scripting language based on CSS that lets you do amazing things with your CSS. We have a new series out, Learning Sass and Compass, to get you up to speed on this new cool tool for front-end development.
tsvenson: Our Drupal Workplace: The Issue Queue
Sooner, not later, you will end up in the Issue Queue on d.o. Its practically unavoidable if you want to get the most out of your relation with Drupal.
The more involved you get, particularly as a code developer or themer, you will find that you spend more and more of your time working on and jumping around between issues. The list of issues you are active in and/or monitoring is constantly growing.
At this point you have turned the issues queue into: Your Workplace!
Read the full "Our Drupal Workplace: The Issue Queue" post on www.tsvenson.comMediacurrent: Drupalcon Portland Video Recap - Day 1
Here's a quick video recap from Drupalcon Portland - Tuesday, May 21st.
Web Wash: How To Notify Site Builders If Something Is Required In Drupal 7
The hook_requirements (API Doc) hook allows you to define custom requirements for modules. The hook can be used to simply notify a site builder with an alert, this is how the Update manager module works. If you have the Update manager module installed and it discovers an out of date module, it'll display an alert that certain modules need updating.
As another example, in the past I've used the hook to display an alert if API login credentials were not available.
You can also define very strict requirements where the installation of a module is aborted when requirements are not met.
In this article we'll look at how to use the hook for install requirements that aborts an installation if the requirements are not met. Then we'll look at how to display an alert, similar to how the Update manager displays alerts.
Field maxlength alter
If you have found this module you have probably created a field with a max_length that is no longer valid. You are either unable to store a value since it exceeds max_length, or perhaps you want to shorten the max_length to reduce database size? The field API in Drupal 7 does not allow you to change this property when data is already stored for a field. When trying to edit the max_length property in the admin interface you will encounter the following message:
There is data for this field in the database. The field settings can no longer be changed.
Or perhaps you encountered the following issue while adding or updating field values programatically:
PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'X' at row X
There are multiple solutions here:
- Drop all your data and modify the field max_lenght. Just kidding, this is not an option
- Modifying the field tables manually in phpMyAdmin
- Creating an update hook that alters the field tables
- Installing this module and simply edit the max_length in the admin interface
- Installing this module and run the Drush command to modify the max_length
I will expand this module page with more information about step 3 since it is a valid option. As you might understand i prefer you just download and use this module :)
Other modules
I have searched for similar modules but have only found the ones that will add validation. If you feel this module should not exists because there is a better alternative please let me know.
Commerce Pre-order
Commerce Pre-order provides a framework to allow pre-ordering products utilizing Drupal Commerce's checkout.
Sponsored by Nack Creative LLC
Features- Special product pricing for pre-order period
- Automatic pending order creation to capture funds once the product is available
This module creates a pre-order price and status field on every product type which is used to trigger special pricing of the product during the pre-order period. The future due amount is accounted via new orders created after checkout.
- Special product pricing for pre-order period
- This module creates a pre-order price and status field on every product type
- Pricing rules set the price to the pre-order price while the product's pre-order is enabled (ie status field)
- Automatic pending future orders creation for each pre-ordered line item
- On checkout complete via rules, pending orders are created for each pre-ordered line item. The line items can be grouped by product type to create fewer pending orders.
- Product type setting for 'combine order' is on the product type form provided by the product ui
- Each new pending order is referenced to the initial checkout order via an entity reference field on the order
Health monitor
Health monitor is a great solution to monitor custom functionality built into your site.
The Health monitor module makes it easy to hook into, and add custom "monitors" that display status messages on an admin dashboard. Health monitor can automatically send e-mails when a monitor returns an error.
Adding a new monitor is simple, just create a hook: hook_health_monitors().
Return some info:
'name' => t('Check number of nodes'),
'group' => t('Example Group'),
'description' => t('Checks to make sure at least 1 node exists.'),
'args' => array('threshold' => 1),
);
This monitor will now call hook_health_monitor_MONITOR().
Your hook should return a status:
$count = get_node_count();
if ($count >= $args['threshold']) {
return array(
'status' => HEALTH_OKAY,
'message' => t('There are !count nodes in the database.', array("!count" => $count)),
);
}
else {
return array(
'status' => HEALTH_ERROR,
'message' => t('There are only !count nodes in the database!', array('!count' => $count)),
);
}
}
.... And you're done. Wasn't that easy?
Pixelite: How to find and debug large variables in Drupal 7
On a recent large Drupal project we were finding that the variable table was holding around 4 MB of data. The issue of course with this is that this is loaded into memory on each page request regardless of whether or not you use it. Another issue is that the variable table holds serialized data, and there is an additional CPU overhead of actually de-serializing the data as well.
Introducing Variable debugSo I wrote a module Variable debug that is a straight forward and simple module that attempts to do only two things (at the moment):
A list of the highest memory usage variables stored in the {variable} table sorted by highest to lowest. There is also a list of links to Drupal.org issues to help resolve some known high usage offenders. If you know of an issue that exists that aims to resolve in-efficient usage of the variable table, please raise a new issue in the issue queue for this module.
A list of all suspected orphaned variables in the variable table. This is determined by whether or not the variable is:
- Not a variable provided by Drupal core
- Does not start with an enabled module name
This can help you find and remove potential abandoned variables that are of no use to you and your site.
Sometimes Drupal contributed modules use the variable table as a dumping ground for large variables that really should be stored in dedicated tables. Here is an example from one of our websites using the SQL query:
SELECT LENGTH(value) AS length, name FROM variable ORDER BY length ASC;And the end of the result:
| 534 | hs_config_taxonomy-17 | | 551 | subscription_mail_status_activated_body | | 561 | hs_config_taxonomy-13 | | 573 | googleanalytics_custom_var | | 580 | article_import_known_columnists | | 600 | menu_masks | | 617 | order_completion_text_digital_auth | | 620 | menu_default_active_menus | | 622 | order_completion_text_corporate_auth | | 626 | user_mail_register_no_approval_required_body | | 638 | menu_minipanels_hover | | 660 | field_bundle_settings_node__page | | 666 | article_import_known_agencies | | 700 | field_bundle_settings_node__collection | | 702 | field_bundle_settings_node__article | | 733 | order_completion_text_print_auth | | 781 | field_bundle_settings_node__promotion | | 869 | order_completion_text_digital | | 903 | subscription_activation_text_unverified | | 939 | order_completion_text_print | | 955 | order_completion_text_corporate | | 991 | field_bundle_settings_node__subscription | | 1012 | subscription_activation_text_pending | | 1073 | field_bundle_settings_commerce_product__subscription_product | | 1278 | entityreference:base-tables | | 1783 | high_risk_districts | | 1988 | commerce_enabled_currencies | | 2356 | metered_useragent_whitelist | | 2515 | rules_empty_sets | | 2796 | apachesolr_index_last | | 3178 | memcache_wildcard_flushes | | 3673 | drupal_js_cache_files | | 7804 | features_codecache | | 14840 | drupal_css_cache_files | | 852329 | imagefield_crop_info | +--------+-----------------------------------------------------------------+ 1207 rows in set (0.02 sec)Anything over several hundred bytes in the variable table really has to take a step back any look at better utilising cache tables.
Integration with Drupal.org issuesThe next feature I added to the module was known large variables, and links to Drupal.org issue queue items that contain patches to resolve the large memory usage.
Here is a screenshot showing the functionality.
QuestionsLet me know in the comments if this helps you, also if you have any other known rogue variables that have Drupal.org issues, that would also be welcome.
Tags drupal drupalplanet debugging code development Source Variable debug Category TutorialConditional Avatar
Use case
It is a field formatter based on custom formatters module.
It is useful when you have users with a imagefield empty and you want to display an standard avatar (male or female) according the values of another field (sex field).
Payment Arbitrary
A standalone form for creating arbitrary payments with the payment module.
- Very useful for a webmaster who needs to log payments against users (sponsorships, taken cash, etc).
- Also good for donations.
UC Simple Bank Transfer
Simple Bank Transfer payment method for Ubercart
Current Version:
- Multiple account from one single settings
Todo:
- Create capability to support multiple bank account
- Create bank transfer report page
- Create bank transfer confirmation page
PayWay
This is an integration of Westpac's PayWay gateway as a method for the Payment module.
Currently it only handles PayWay Net (Not PayWay API).
Term Value
Term Value provides a new compound field type allowing entry of term reference and textfield pairs. The use case for this is to use a vocabulary to define types of values that can be provided, leaving it up to the content author to choose what values are provided.
WidgetsCurrently we only have a select list for term reference and textfield for value. This module could potentially support autocomplete term reference and textarea etc but not at the moment.
FormattersThere are three formatters provided, choose which one suits you best. In future additional settings may exist, such as linking the term reference to the term page.
- Separate fields: Attempts to render each term/value pair as if they were separate fields. Please report any issues that may arise with this formatter.
- Separate items: Very basic rendering of each item using the Form API item type.
- Table of term/value pairs: Terms on the left, values on the right. Some formatter settings could be useful here.
Works well for separate items and table formatters. Not so well for separate
fields. Not sure it will be possible to provide decent filtering options either.
Chapter Three: Zact: Launching a Major Mobile Startup
We just launched Zact, one of our largest design projects to date at Chapter Three. We designed nearly 200 comps, including an e-commerce workflow, a customer dashboard that mirrors the functionality of the phone’s software, a Support section built on ZenDesk, and a consumer-facing website.
A disruptive new cell phone provider, Zact is a new company looking to redefine how customers purchase mobile services by making your plan 100% customizable right from your phone with no overage fees or contracts. They even give you a refund every month for any unused minutes, texts or data.
Helping Zact overcome business hurdles
As a new company in a major market, Zact turned to Chapter Three to help them solve some of their immediate business hurdles online.
- Establishing brand trust
To overcome lack of brand recognition and to educate new customers about the key advantages of the service, we created the “Why we're different” and “How it works” sections as a way for new customers to get to know us. - Paying full price for the phone
To educate customers about the long term savings of buying the phone at full price, we created an interactive Savings Calculator. The calculator allows customers to compare various plan and phone options to their current bill to show their dollar amount saved over a two year period. - Buying a phone online
Without the ability to physically touch the phone customers are buying, we needed to build in extra guarantees to make customers feel comfortable purchasing a device online. We featured a “satisfaction guarantee” statement prominently throughout the site, promising a refund within 30 days if the customer did not like the phone.
Herculean feats of UX strength
The complexity of interactions across the site gave us an opportunity to flex our UX chops. We collaborated with Zact’s usability specialist, incorporating feedback from weekly usability tests to iteratively improve our designs.
- Customer dashboard
To provide the functionality of the phone’s software on the website, we designed a web-specific interpretation of the phone software that empowers customers to access and control the full breadth of Zact’s service offerings. Because the software was being developed in parallel with our web design, we adopted an agile design approach to iterate in sync with the development team. - E-commerce
Our team worked with Zact’s usability specialist to implement a checkout flow pulling from best practices across the web. We delivered a solution that pushes the capabilities of Drupal Commerce and its ability to integrate with third-party systems.
Agile design
An agile design process was critical in the success of this project. We needed to be flexible as requirements and scope were changing daily. We met with the client daily via WebEx with new design deliverables for review, which allowed us to gather feedback often and respond quickly. For any given page, we were able to explore a number of options on a high level before focusing on a more final solution.
In fact, some of the best ideas on the project came directly from the client, as a result of organic discussion during those meetings. The Savings Calculator, which allows users to more visually understand how they will save money over time with Zact, grew out of a conversation we facilitated.
Our first iterations of the Savings Calculator were pretty skeletal and didn’t quite feel right; the user had to fill out the form and click a button before seeing results. After further discussion, the client suggested that we make the actual dollar savings visible and dynamic throughout the page, so that as you interact with the form you can directly see how your savings are affected. This minor design change immediately made the page more engaging and an effective tool in communicating why Zact is a viable alternative to a traditional phone contract.
Starting up in Silicon Valley with Drupal
One of the most exciting and challenging parts of the project was the rapid pace of startup culture. The level of expertise and web savvy amongst Zact’s staff allowed for a flourishing partnership where we were able to push boundaries and do great work together. So far, the site has been covered by some major press outlets, including Gizmodo, Engadget, Forbes and TechCrunch.
The site is finally live, but our work isn’t over yet. We’re continuing to evaluate and optimize the usability of the site and will continue to roll out design updates over the coming weeks. We look forward to working further with Zact and seeing how users will react to the new site.
Batch video
Tired looking at the boring batch page ? Always going for a walk when running simpletests until they are done ?
Add a video to it and have some fun while you wait! Videos are config entities, so you can easily create your own videos.
Inspired by Alex Pott during a Drupalcon breakfast.
Mark Shropshire: DrupalCon Portland (Day 1 2013-05-20)
- Flight arrived late Sunday night and took the Portland MAX light rail to the hotel. Grabbed something to eat and went to bed 4PM EST!
- Had a descent breakfast at the hotel
- Went on the "Secrets of Portlandia" free walking tour (http://secretsofportlandia.com). This was a great tour. I highly recommend it if you come to Portland.
- Lunch (frozen yogurt!)
- Took a walk across the river to the Burnside Skate Park that Brent Dunn wanted to checkout.
- We then made it over the the Oregon Convention Center to get our registrations
- Met with greggles to discuss keynoting DrupalCamp Charlotte and some Classic security related questions. including security audits and Guardr/Hardened Drupal
- Worked on the DrupalCamp Charlotte website
- Dinner at a local brewery
- Worked more on the DrupalCamp Charlotte website
HubSpot Blog Integration
The HubSpot Blog Integration module is built to pull blog content created in HubSpot to be used within the Drupal site.
Slider Popup
This is a joint Educational project of the Drupalista's group to implement a panel that 'slides' out from the left or right, over the content of a page. In the initial version, the content of the panel is entered through the administrative panel and there is one trigger block that can be positioned in a region. Later versions will support multiple trigger blocks and panels. The Link below describes our initial project. The feature to implement the animated buttons within the panel will be implemented in a separate CKeditor plugin.
Wunderkraut blog: From Content to Experience — Dries Buytaert's Drupalcon Keynote
Dries Buytaert, Drupal's founder and project lead, presents his six-monthly keynote at Drupalcon, and sets out where he thinks Drupal needs to go.
Dries starts by talking about a highly visible sign of growth in Drupal — 8 years ago he and half of the conference delegates were able to fit into one hotel room for drinks on the night before the event opened. This year, over 3,000 delegates took over and filled up most of the bars in Portland, Oregon.
Next he shows how the users of Drupal have grown too. He says that 3-5 years ago it was just a hope that one day the White House website, and major broadcasters like NBC would use Drupal.
Dries then returns to a theme he has raised in previous keynotes — summed up by the phrase "Do Well, Do Good". He says that as a result of Drupal's success, and the success of the businesses and careers of those who work on it, the world is benefiting. Hundreds of thousands of charities and non-profits are able to download Drupal for free and adapt it for their needs, to better achieve their aims — raising money, organising volunteers and campaigning.
But also, there are now over a hundred countries whose governments use Drupal to help provide better public services online to citizens.
The White House Case StudyTo illustrate this, Dries introduces a video in which Macon Phillips, the Director of Digital Strategy at The White House, speaks about their use of Drupal.
Macon says that they launched WhiteHouse.gov on Drupal in October 2009. They did a lot of work to assess the best system for them to use, and whether they could adopt open source. They have had great success with their choice of Drupal. As a result they've been keen to give back to the community, and have contributed a number of modules, and hosted a 'hack day' at the White House.
He gives the example of the 'We The People' petitioning application. It allows anyone to start a petition, and anyone to sign it online. The executive has pledged to respond to petitions that get enough signatures. Since its launch in September 2011 over 8 milion people have signed a petition on the site. Something that would only be possible online. It's a new way to scale civic participation.
The open nature of Drupal means they can now extend this even further, and they have launched a Read API to allow other websites to pull in data about petitions. They are now also planning a Write API to allow other applications to help people create and sign petitions.
ContextDries next moves to talking about context. He says it's the availability of these petitions online that enables more people to engage with them. What's true in government is also true in business. People need the right content, in the right place, at the right time. Context is key.
He gives the examples of Amazon and Netflix. Able to personalise their sites and give recommendations and related content to users. As a result they've been able to massively disrupt their markets.
However, most organisations are currently really bad at this.
Dries shows a google search for 'flight to London'. The first result is actually from Icelandair which does really well — when he clicks through to the site, it prefills the form with 'London' as the destination for him, shows images of London to get him excited, and even knows that he wants to get there from Boston where he is now. Meanwhile, the next result Google presents, Continental, just takes him to a blank search form when he clicks through.
Context can be about many things. Some examples are geography, past behaviour, intent, device used, the time of day, and many more.
By responding to the context, you provide a much better experience to the user — what is becoming known as Web Experience Management (WEM).
Web Experience ManagementOwners of websites want to do this in three stages, each of which requires integration with other systems:
- Stage 1: Attract — by using SEO, mobile platforms, social networks
- Stage 2: Convert — using CRM systems, email, ecommerce, personalisation and marketing automation systems
- Stage 3: Analyse — using CRM, analytics and marketing automation
So the Content Management System needs to integrate with all these other systems.
But, Dries cites recent research that shows that marketers are really unhappy with the state of integrations between CMSs and other systems such as CRM, ecommerce, personalisation etc. Just 6% of those surveyed were able to describe the integration between their CMS and their CRM as excellent.
At the moment these kinds of sites are using big proprietary systems, and Dries says this level of disatisfaction presents a great opportunity for Open Source, and Drupal in particular.
How To Address WEM With DrupalSo how could we develop Drupal to serve the future needs of these organisations?
- The Drupal community could build these kinds of CRM and marketing automation tools ourselves. That's what competitors are doing — creating proprietary product suites to try to handle it all.
- Drupal could focus on being very good at integrating with other systems. There are many good integration modules already, but these could be extended and improved.
Dries says that research supports the second option. End users want 'best of breed' tools that work well together. So, if we don't go the route of building everything ourselves, what do we need to do?
What Clients Want from a CMSThe research, says Dries, shows that clients want three things from a CMS:
- Integrate best of breed tools
- Deliver a great mobile experience
- Ease of Use & Content Authoring
Dries says that all of these are addressed in Drupal modules — but what's more they are all addressed in Drupal 8 core:
- Integrate best of breed tools: Web services are now provided in core to facilitate these integrations; all content can be exported as JSON or XML easily.
- Deliver a great mobile experience: Responsive theming makes for better user experience on mobile; the web services mean better integration with mobile apps; even the admin and editing interface is mobile ready or can be managed via an app.
- Ease of Use & Content Authoring: The admin user interface and content editing forms have been completely redesigned; In-place editing allows content to be edited at a click in the frontend; Images can be added to pages with drag and drop; there is now a true Preview of content, and they are working on enabling this to preview at different screen sizes.
The first alpha of Drupal 8 will be released during this week, and the developers are working towards the code freeze deadline of 1st July 2013. The aim is to have a stable release by the end of 2013 or early 2014. Sites will be able to use Drupal 8 in 2014.
Dries summarises by saying it is important for Drupal to 'skate to where the puck is', and that it is no longer enough to simply manage content. Drupal has to be a key part in enabling site owners to manage the whole experience for users.
By moving in this direction, Dries says that developers get to work on what matters, Drupal companies get to deliver what clients want, Drupal users can improve their business by shifting more of it to digital, and for the world we'll be doing well, and doing good.
Views Result Context
This is a Context plugin which allows you to set a condition when a chosen view returns any results, because sometimes you use the context module, and some of those times you maybe use views, and perhaps some of those times you want to set a context condition when a given view returns a result. This is a module for those times.
Inspired and copied from carn1x in comment #1 of #1313022: Define a Context by the number of rows in a View (which uses hook_init instead of hook_views_post_execute used here)
