Planet Drupal

Subscribe to flux Planet Drupal
Drupal.org - aggregated feeds in category Planet Drupal
Mis à jour : il y a 2 min 51 sec

Bluespark Labs: Start your content + commerce revolution

jeu, 22/01/2015 - 15:59

Shifting to a content-driven commerce focus is a daunting challenge.

Whether you are a media company adding commerce to your site or a retail site wanting to add richer editorial, there are very different skillsets required to sell product versus those needed for writing and curating content. How do you successfully blend these skillsets — much less these seemingly disparate websites — into a single, cohesive whole?

It ain’t easy, but it’s worth it.

From Media to Commerce

Adding commerce to a media site is tricky. On the one hand, product recommendations can add a new dimension of value to both you and your readers. Just like advertising, though, (and maybe more so), you run the risk of corrupting a brand that your readers have come to trust.

Promotion!

If you are making the step into content-driven commerce, you must be willing to promote products on your site. Sounds like a no-brainer, right? But integrity is one of the things that readers value from media sites. And if they feel like they are being pushed toward a bad product (or even an unrelated product), they will likely revolt.

Now, the promotions don’t have to be in your face, “everything must go”, car-sales promotions. In fact, those are the exact promotions that will spark revolution. But you must be willing to add tasteful product descriptions and honest reviews and recommendations. This means putting your trusted brand behind a product that you like — and, more importantly, one that you think your readers will like.

Not selling out

There is a fine line between promoting product and selling out. Sometimes it’s easy to find. Don’t like a product? Think a product is cheaply made? Don’t recommend it no matter how sweet that affiliate commission looks.

But what about a product you love versus one that you like? The one you love, right? But what if that second product has a much better affiliate program?

It’s tricky. But you can probably find a way to promote both. The Wirecutter (and their sister site, The SweetHome) approach to product reviews is a great example of this. They write in-depth product reviews for different categories of gadgets. Each review has a recommended product along with explanations of why they did and didn’t like some of the other options they reviewed. Each product is a link to Amazon (and other stores) and every link has their affiliate code.

It’s a smart, if intense, solution that allows them to promote a lot of different products without selling out. In fact, it’s quite the opposite. Readers trust the site more because they go into so much detail about so many options.

From Commerce to Media

Now, if you are going in the opposite direction (adding content to your commerce site), then you’ll experience a range of other issues that can be even more challenging. In many respects, they run counter to much of the marketing culture that permeates most retail shops — unless those shops have come to value content-marketing and storytelling as a way to increase online sales.

Content Production

Editorial content is a whole new world. Marketing content goes through a series of edits and reviews. It’s often bland and boring. Intentionally so. You need to put the best foot forward of every product you sell — no matter how much that description might gloss over hard truths.

With a content-driven commerce approach, though, using your marketing-style for your editorial content will sabotage your efforts. You need something with a voice and style that captures people’s attention and engages them on a personal level. Something that product descriptions almost never do.

Willingness to curate

Once you start producing content, you need to start curating it. What products are going to make it onto your top 10 list? Which set of widgets are you going to include in your how-to article? You know those items you promote are going to get more views and more clicks — even a bump in brand perception — that other products won’t.

After you’ve written the piece, then you need to decide what content you’re going to promote on the homepage and throughout the site. Another tough decision. This one, though, fits closely inline with your sales planning process — which sale are promoting and when.

Treating content as a first-class citizen

Another aspect of content-driven commerce that may seem anathema to many commerce sites: treat your content like a first-class citizen. Specifically: give it equal weight on your homepage, which means treating it the same as you would a sale or other promotion. The challenge for many is that this feels like you are losing sales. But you’re trading a bump in short-term sales for long-term engagement.

There are many companies that have seemingly embraced content-driven commerce as a strategy. Big brands like Home Depot, Lowes, and Brooks Brothers are producing some amazing content. A quick glance at their homepages, though, and the only hint at this content is behind a single link. Everything on these pages is focused on the latest sale and other product promotions. This may be a strategic decision or a technological limitation. Regardless, these websites have yet to really embrace content as a cornerstone to their brand.

Admittedly, there are many ways to enter a website—from Google to social media. But what a company includes on their homepage speaks volumes about what a brand values.

Gaining trust

Does your audience see you as an expert on the product you sell (Crutchfield)? Or just as a fancy storefront (Best Buy). In either case, gaining and maintaining the trust of your audience is critical — and, depending on your current relationship with your customers, may be an uphill slog.

Are you willing to write a bad review of a product? Are you willing to pull a product if there are no redeeming qualities? Are you willing to write content that doesn’t directly sell the product?

Imagine if Best Buy started producing content that actually helped their audience better understand and use the technology they were selling. As it is, the store (and by extension, website) has limited audience engagement and does nothing to pull anyone to their site — other than offer product promotions and discounts.

One of the fundamental requirements to succeeding with any kind of content-driven strategy is audience trust. You need to build trust with your audience and you can’t do that if they feel like you are selling them anything and everything.

The move to content-driven commerce

Making the decision to integrate content and commerce has its challenges. The exact challenges you face will really depend on the culture of your organization as well as the abilities and mindset of your staff. But if you’re willing to make the necessary changes to engage your audience and build their trust, you can make the transition.

If you’re moving from a media site into commerce, they key will be maintaining your readers' trust and your own integrity. If you’re moving in the opposite direction, the challenge will be gaining the reader’s trust, which means making some pretty big organizational and cultural changes.

In both cases, though, you’ll find the move well worth the effort.

Tags: Drupal Planet
Catégories: Elsewhere

Open Source Training: Add a New Moderation State Tab to Workbench

jeu, 22/01/2015 - 06:14

One of our members was watching our video class on Drupal's Workbench module and has been getting it set up on their site.

They ran into one problem: how to use the new moderation states they added.

They wanted add a tab so that people could easily see the content in a particular moderation state.

In this tutorial, we'll show you how to make that happen.

Catégories: Elsewhere

Blink Reaction: The Drupal Console is Now Multilingual

mer, 21/01/2015 - 17:14

We're very pleased to announce that the new Drupal Console project is now multilingual!

We put a lot of hours into this effort because we felt it was so important to broaden the base of Console users and help them get off to a great start developing modules for Drupal 8. It will be the last major feature to be added before an upcoming code freeze that will allow us to work on Console documentation - another effort to broaden the base of users that can benefit from the project.

Catégories: Elsewhere

Symphony Blog: How to customize Drupal contact form (form title, result redirect)

mer, 21/01/2015 - 08:06

The default contact form in Drupal has quite basic settings. You may only create categories and receiving emails with the default UI admin. To change other preferences such as form title or form destination, we may have to implement override hooks.

In this article, we present some tricks to customize the contact form in Drupal. More tricks will be added regularly.

1. Edit the contact form title

To change the title, add this function to template.php on your theme folder (/sites/all/themes/your-theme/template.php)


<?php
function mytheme_form_contact_site_form_alter (&$form, &$form_state) {
drupal_set_title ('Contact ABC Media');
}

2. Redirect form result

By default, users will be redirected to front pages after submitting the form. It has a strange behavior for users because they may confuse what is going on, whether the message has been sent.

read more

Catégories: Elsewhere

ThinkShout: The Clutter and the Deceptively Simple

mer, 21/01/2015 - 01:00

2015 is poised to be a great year for nonprofit technology and the adoption of digital tools to advance the causes we love. While I can’t say that I see too many groundbreaking innovations on the immediate horizon, I do believe that this will be a year of implementation and refinement. Building upon trends that we saw arise last year in the consumer industry and private sector, 2015 will be the year that many nonprofits leap into digital engagement strategies and begin to leverage new tools that will create fundamental change in the way that they interact with their constituencies.

Of course, as always happens when a growing sector first embraces new tools, the nonprofit technology world will see more than its fair share of awkward clunkiness this year, mainly as "software as a service" product companies rebrand their offerings for nonprofits and flash shiny objects at the earnest and hungry organizations we all support.

But as a more general and appealing trend, I believe that we’ll see a slimming down and a focus on polish this coming year. Visual storytelling and "long form" journalism are hopefully on the rise in the nonprofit digital world. We should see more, and better, integrations between web applications, data management systems, and social networks. These integrations will power more seamless and personalized user experiences. Rather than tossing up an incongruent collection of web interfaces and forms delivered by different paid service platforms, nonprofits will be able to present calls-to-action through more beautiful and less cumbersome digital experiences.

Below are some additional thoughts regarding the good stuff (and some of the bad) that we’re likely to see this year. If you have any additional predictions, please share your thoughts!

Visual Storytelling and the Resurgence of Long-Form Journalism

I don’t know about you, but I’m tired of my eyeballs popping out of my head every time I visit a nonprofit’s homepage that attempts to cram 1,000 headlines above the fold. I’m tired of the concept of "a fold" altogether. And don’t get me started about slideshow carousels as navigation: It’s 2015, folks!

Fortunately, we are seeing an elegant slowdown in the pace of writing for the web. Audiences are getting a little more patient, particularly when presented with clean design, pleasing typography, and bold imagery. We’re also seeing nonprofits embrace visual storytelling, investing in imagery and content over whistles and bells and widgets.

Medium and Exposure are my two favorite examples of impactful long-form journalism and visual storytelling on the web. These deceptively simple sites leverage cutting-edge javascript and other complex technologies to get out of the way and let content and visuals speak for themselves.

As an added benefit, adopting this more long-form storytelling approach may help your SEO. Google took bold steps in late 2014 to reward websites that focus on good content. With its release of Panda 4.1, their new search algorithm, nonprofits who prioritize long-form writing and quality narrative will start to see significant benefits.

We’re already seeing nonprofits adopt this approach, including one of my new favorites, The Marshall Project. This site cuts away the usual frills and assumes an intelligent audience that will do the work to engage with the content. Don’t get me wrong: The Marshall Project website is slick and surprisingly complex from an engineering and user experience perspective – but its designers have worked hard to bring the content itself to the surface as the most compelling call-to-action.

Interconnectivity

2015 will be a big year for APIs in the CMS space. Teasing out those acronyms, we will see content management systems, like Drupal and WordPress, release powerful tools allowing them to talk with other web applications and tools. Indeed, its new web services layer is a central and much anticipated feature in the upcoming release of Drupal 8. WordPress made similar strides late last year with the early release of its own REST API.

Leveraging these APIs, 2015 will bring the nonprofit sector more mobile applications that share data and content with these organizations’ websites. The costs for developing these integrations should decrease relative to the usefulness of such solutions, which will hopefully lead to more experimentation and mobile investment among nonprofits. And as mentioned previously, because these new applications will have access to more constituent data across platforms, they will lend themselves to more robust and personalized digital experiences.

On the less technical and more DIY front, 2015 will be marked by the maturation of 3rd-party services that allow non-developers to integrate their online tools. In its awesome post about technology trends in 2015, the firm Frog Design refers to this development as the "emergence of the casual programmer." Services like Zapier, and my new favorite IFTTT, will allow nonprofits to make more out of social networks and services like Google Apps, turn disparate data into actionable analytics, see the bigger picture across networks, and make more data-driven decisions.

More Big (And Perhaps Clunky) Web Apps

If you’ve been following ThinkShout for a while now, you probably know that we are big fans of Salesforce because of its great API and commitment to open data. We maintain the Salesforce Integration Suite for Drupal. At this point, the majority of our client work involves some sort of integration between the Drupal CMS and the Salesforce CRM.

As proponents of data-driven constituent engagement, we couldn’t be more excited to see the nonprofit sector embrace Salesforce and recognize the importance of constituent relationship management (CRM) and CRM-CMS integration. Because of the power of the Salesforce Suite, we can build powerful, gorgeous tools in Drupal that sync data bidirectionally and in real time with Salesforce.

That said, part of the rise of Salesforce in the nonprofit sector over the last two years has been driven by the vacuum created by Blackbaud’s purchase of Convio. And now, with the recent releases of Salesforce’s NGO Connect and Blackbaud’s Raiser’s Edge NXT, both "all-in-one" fundraising solutions with limited website integration potential (in my opinion…), we’re going to see more and more of an arms race between these two companies as they try to “out featurize” each other in marketing to nonprofits. In other words, in spite of the benefits from integrating Drupal and Salesforce, we’re going to see big nonprofit CRM offerings like Salesforce and Blackbaud push competing solutions that try to do everything in their own proprietary and sometimes clunky ecosystems.

The Internet of Things

The Internet of Things (IoT), or the interconnectivity of embedded Internet devices, is not a new concept for 2015. We’ve seen the rise of random smart things, from TVs to refrigerators, for the last few years. While the world’s population is estimated to reach 7.7 billion in 2020, the number of Internet-connected devices is predicted to hit 26 billion that same year. Apple’s announcement of its forthcoming Watch last year tolled the the first meaningful generation of wearable technology. Of course, that doesn’t necessarily mean that you’ll want to wear this stuff just yet, depending upon your fashion sense...

(Image from VentureBeat’s coverage of the 2015 Consumer Electronics Show last week. Would you wear these?)

However, the advent of the wearable Internet presents many opportunities to the nonprofit sector, both as a delivery device for micro-campaigns and targeted appeals, and as a tool for collecting information about an organization’s constituency. Our colleagues at BlueSpark Labs recently wrote about how these technologies will allow organizations to build websites that are really "context-rich systems." For example, with an Internet-connected watch synced up to a nonprofit’s website, that organization could potentially monitor a volunteer athlete’s speed and heart rate during a workout. These contextualized web experiences could drive deeper feelings of commitment among donors and other nonprofit supporters.

(Fast Company envisions how the NY Times might cover election result's on the Apple Watch.)

Privacy and Security

While not exactly a trend in nonprofit technology, I will be interested to see how the growing focus on Internet privacy and security will affect online fundraising and digital engagement strategies this year.

(A poster for the film, The Interview, as most of you probably know, the film incited a major hack of Sony Studios and spurred international dialog about cyber security.)

We are seeing more and more startups providing direct-to-consumer privacy and security offerings. This last year, Apple release Apple Pay which adds security, as well as convenience, to both online and in-person credit card purchases. And Silent Circle just released Blackphone - an encrypted cell phone with a sophisticated and secure operating system built on top of the Android platform.

How might this focus on privacy and security affect the nonprofit sector? It’s hard to say for sure, but nonprofits should anticipate the need to pay for more routine security audits and best practices regarding maintenance of their web properties, especially as these tools begin to collect and leverage more constituent data. They should also consider how their online fundraising tools will begin to support new online payment formats, such as Apple Pay, as well as virtual currencies like BitCoin.

And Away We Go…

At ThinkShout, we’ve already rolled up our sleeves and are excitedly working away to implement many of these new strategies and approaches for our clients in 2015. What are you looking forward to seeing in the world of of nonprofit tech this year? What trends do you see on the horizon? Let us know. And consider swinging by the "Drupal Day for Nonprofits" event that we’re organizing on March 3rd in Austin, TX, as part of this year’s Nonprofit Technology Conference. We hope to dream with you there!

Catégories: Elsewhere

Drupal core announcements: MidWest Developers Summit

mar, 20/01/2015 - 20:33
Start:  2015-08-12 (All day) - 2015-08-15 (All day) America/Chicago Sprint Organizers:  gdemet webchick xjm

This is a place holder to get MWDS on the calendar.
Wednesday August 12 - Saturday August 15

All sprint days. No sessions.
Focus on getting Drupal 8 released (and some key contrib ports to Drupal 8).

More details soon.

Will be hosted in Chicago at http://palantir.net/
2211 N Elston Avenue
Suite 400
Chicago, Illinois 60614

Catégories: Elsewhere

Shomeya: Model Your Data with Drupal and Domain-driven Design

mar, 20/01/2015 - 18:00

On of the things I've blogged about recently when talking about my upcoming book Model Your Data with Drupal is domain-driven design. While domain-driven design is important and something that I hope to touch on in the future, I've decided it's too much to cover in one book, and I'm refocusing Model Your Data with Drupal on basic object oriented principles.

If you want to know more about this decision and what will be covered in Model Your Data with Drupal, read on.

Read more
Catégories: Elsewhere

Drupal Watchdog: Something Borrowed, Something Drupal

mar, 20/01/2015 - 17:59
Feature


Drupal 8 represents a radical shift, both technically and culturally, from previous versions. Perusing through the Drupal 8 code base, many parts may be unfamiliar. One bit in particular, though, is especially unusual: A new directory named /core/vendor. What is this mysterious place, and who is vending?

The "vendor" directory represents Drupal's largest cultural shift. It is where Drupal's 3rd party dependencies are stored. The structure of that directory is a product of Composer, the PHP-standard mechanism for declaring dependencies on other packages and downloading them as needed. We won't go into detail about how Composer works; for that, see my article in the September 2013 issue of Drupal Watchdog, Composer: Sharing Wider.

But what 3rd party code are we actually using, and why?

Crack open your IDE if you want, or just follow along at home, as we embark on a tour of Drupal 8's 3rd party dependencies. (We won't be going in alphabetical order.)

Guzzle

Perhaps the easiest to discuss is Guzzle. Guzzle is an HTTP client for PHP; that is, it allows you to make outbound HTTP requests with far more flexibility (and a far, far nicer API) than using curl or some other very low-level library.

Drupal had its own HTTP client for a long time... sort of. The drupal_http_request() function has been around longer than I have, and served as Drupal's sole outbound HTTP utility. Unfortunately, it was never very good. In fact, it sucked. HTTP is not a simple spec, especially HTTP 1.1, and supporting it properly is difficult. drupal_http_request() was always an after-thought, and lacked many features that some users needed.

Catégories: Elsewhere

Blink Reaction: Give me a Swiss knife, Pleeease!

mar, 20/01/2015 - 17:25
All the annoying CSS stuff we don't want to do in 1 tool. One tool for stylesheets
Catégories: Elsewhere

EchoDitto Tech Blog: Code Management in Drupal 7 using Features, Ctools, and Panels

mar, 20/01/2015 - 17:22

Code structure is something most Drupal developers wrestle with. There are tons of modules out there that make our lives easier (Views, Display Suite, etc.) but managing database configuration while maintaining a good workflow is no easy challenge. Today I'm going to talk about a few approaches I use in my work here at Echo. We will be using a simple use case of creating a paginated list of blog posts. To start, we're going to talk about the workflow from a high level, then we'll get into the modules that leverage Drupal in a way that makes sense. Finally, we'll have some code samples to help guide things along.

Workflow

This will vary a bit based on what you need, but the idea behind this is we never want to redo our work. Ideally we'd like to design a View or functionality once on our local, and then package it and push it up. Features is a big driving force behind this. Beyond that, we want things like page structures and custom code to have a place to live that makes sense. So, for this example we will be considering the idea of a paginated list of Blog Posts. This is a heavy hammer to be swinging at such a solved task, but we will get into why this is good later on.

  • Create a new Feature that requires ctools and panels (and not views!)
  • Open up the generated .module file and declare the ctool plugin directory
  • Create the plugins/content_types/blog_posts.inc file
  • Define the needed functions within blog_posts.inc to make it work
  • Add the newly created content type to a page in Page Manager
  • Add everything we care about to the Feature and export it for deployment
Installation

This only assumes that you have a working Drupal installation and some knowledge of how to install modules. In this case, we will be using drush to accomplish this, but feel free to pick your poison here. Simply run the following commands and answer yes when prompted.

drush dl ctools ds features panels strongarm drush en ctools ds features panels strongarm page_manager

What we have done here is install and enable a strong foundation on which we can start to scaffold our site. Note that I won't be getting into folder structure too much, but there are some more steps before this you would have to take to ensure contrib, custom, and features all make it to their own place. We wave our hands at this for now.

Features

The first thing we're going to do is generate ourselves a Feature. Simply navigate to Structures -> Features -> Create Feature and you will see a screen that looks very similar to this. Fill out a name, and have it require ctools and panels for now.

This will generate a mostly empty feature for us. The important part we want here is the ability to turn it on and off in the Features UI, and the structure (that we didn't have to create manually!) which includes a .module and .info file is ready to go for us. That being said, we're going to open it up and tell it where to find the plugins. The code to do that is below, and here is a screenshot of the directory structure and code to make sure you're on the right track. Go ahead and create the plugins directory and associated file as well.

function blog_posts_ctools_plugin_directory($owner, $plugin_type) { return 'plugins/' . $plugin_type; } Chaos Tools

Known more commonly as ctools, this is a module that allows us this plugin structure. For our purposes, we've already made the directory and file structure needed. Now all we have to do is create ourselves a plugin. There are three key parts to this: plugin definition, render function, and form function. These are all defined in the .inc file mentioned above. There are plenty of resources online that get into the details, but basically we're going to define everything that gets rendered in code and leverage things like Display Suite and the theme function for pagination. This is what we wind up with:

<?php   /** * Plugin definition */ $plugin = array( 'single' => TRUE, 'title' => t('Blog Post Listing'), 'description' => t('Custom blog listing.'), 'category' => t('Custom Views'), 'edit form' => 'blog_post_listing_edit_form', 'render callback' => 'blog_post_listing_render', 'all contexts' => TRUE, );   /** * Render function for blog listing * @author Austin DeVinney */ function blog_post_listing_render($subtype, $conf, $args, &$context) { //Define the content, which is built throughout the function $content = '';   //Query for blog posts $query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'node', '=') ->entityCondition('bundle', 'blog_post', '=') ->propertyCondition('status', NODE_PUBLISHED, '=') ->pager(5);   //Fetch results, and load all nodes $result = $query->execute();   //If we have results, build the view if(!empty($result)) { //Build the list of nodes $nodes = node_load_multiple(array_keys($result['node'])); foreach($nodes as $node) { $view = node_view($node, 'teaser'); $content .= drupal_render($view); }   //Add the pager $content .= theme('pager'); }   //Otherwise, show no results else { $content = "No blog posts found."; }   //Finally, we declare a block and assign it the content $block = new stdClass(); $block->title = 'Blog Posts'; $block->content = $content; return $block; }   /** * Function used for editing options on page. None needed. * @author Austin DeVinney */ function blog_post_listing_edit_form($form, &$form_state) { return $form; }

Some things to note here. We're basically making a view by hand using EntityFieldQuery. It's a nifty way to write entity queries a bit easier and comes with some useful how to's on Drupal.org. We also offload all rendering to work with Display Suite and use the built-in pagination that Drupal provides. All things considered, I'm really happy with how this comes together.

Panels

Finally, we need to add this to the page manager with panels. Browser to Structure -> Pages -> Add custom page and it will provide you with a step by step process to make a new page. All we're going to do here is add our newly created content type to the panel, as shown here.

And now, we're all ready to export to the Feature we created. Go on back to and recreate the feature and you're ready to push your code live. After everything is said and done, you should have a working blog with pagination.

.

Motivation

Obviously, this example is extremely basic. We could have done this in a View in far less time. Why would we ever want to use this? That's a great question and I'd like to elaborate on why this is important. Views are great and solve this problem just as well. They export nicely with Features and can even play with Panels (if you want to use Views as blocks or content panes). That being said, this is more for the layout of how we would have custom code that works with a lot of Drupal's best practices. Imagine instead if we have a complicated third party API we're trying to query and have our "view" react to that. What if we want a small, code-driven block that we can place discretely with panels? The use cases go on, of course.

There are many ways to solve problems in Drupal. This is just my take on a very clean and minimal code structure that allows developers to be developers and drive things with their code, rather than being stuck clicking around in menus.

Tags: drupaldrupal 7ctoolspanelsfeaturestechnologymaintainability
Catégories: Elsewhere

Dcycle: Multiple git remotes, the --depth parameter and repo size

mar, 20/01/2015 - 16:31

When building a Drupal 7 site, one oft-used technique is to keep the entire Drupal root under git (for Drupal 8 sites, I favor having the Drupal root one level up).

Starting a new project can be done by downloading an unversioned copy of D7, and initializing a git repo, like this:

Approach #1 drush dl cd drupal* git init git add . git commit -am 'initial project commit' git remote add origin ssh://me@mygit.example.com/myproject

Another trick I learned from my colleagues at the Linux Foundation is to get Drupal via git and have two origins, like this:

Approach #2 git clone --branch 7.x http://git.drupal.org/project/drupal.git drupal cd drupal git remote rename origin drupal git remote add origin ssh://me@mygit.example.com/myproject

This second approach lets you push changes to your own repo, and pull changes from the Drupal git repo. This has the advantage of keeping track of Drupal project commits, and your own project commits, in a unified git history.

git push origin 7.x git pull drupal 7.x

If you are tight for space though, there might be one inconvenience: Approach #2 keeps track of the entire Drupal 7.x commit history, for example we are now tracking in our own repo commit e829881 by natrak, on June 2, 2000:

git log |grep e829881 --after-context=4 commit e8298816587f79e090cb6e78ea17b00fae705deb Author: natrak <> Date: Fri Jun 2 18:43:11 2000 +0000 CVS drives me nuts *G*

All of this information takes disk space: Approach #2 takes 156Mb, vs. 23Mb for approach #1. This may add up if you are working on several projects, and especially if for each project you have several environments for feature branches. If you have a continuous integration server tracking multiple projects and spawning new environments for each feature branch, several gigs of disk space can be used.

If you want to streamline the size of your git repos, you might want to try the --depth option of git clone, like this:

Approach #3 git clone --branch 7.x --depth 1 http://git.drupal.org/project/drupal.git drupal cd drupal git remote rename origin drupal git remote add origin ssh://me@mygit.example.com/myproject

Adding the --depth parameter here reduces the initial size of your repo to 18Mb in my test, which interestingly is even less than approach #1. Even though your repo is now linked to the Drupal git repo, by running git log you will see that the entire history is not being stored.

Tags: blogplanet
Catégories: Elsewhere

Code Karate: An introduction to Git (part 1)

mar, 20/01/2015 - 16:18

If you are not already using Git on your Drupal websites or projects, now is the time to learn.

Catégories: Elsewhere

Sooper Drupal Themes: Drupal CMS Powerstart Tutorial 2: Responsive websites with Bootstrap 3 and Drupal

mar, 20/01/2015 - 15:36

This tutorial will showcase how we have made Bootstrap 3 and especially its responsive grid system and integral part of the platform, and will show you how to use some easy tools to make any website component or content mobile friendly!

About Bootstrap 3 in CMS Powerstart

The Drupal CMS Powerstart disbitrution has made Bootstrap 3 an integral part of the platform. The main reason we did this is to leverage the Bootstrap 3 responsive grid system. This grid system is not just functional, practical and effective.. it's also widely used, widely understood and very well documented. On top of that, Bootstrap 3 is an active open source project, like Drupal, and also supported very well with Drupal through a basetheme and various modules. This tutorial will teach you about these integrations and how to use them to create awesome responsive websites with ease. This tutorial will focus more on Drupal integration than on the gridsystem itself. For a quick introduction to the grid system check out this tutorial. For real life examples check out our Drupal themes.

2.1 Bootstrap on blocks

Forget about themes with 16 regions, or 25 regions. If your'e using Bootstrap you really only need full-width regions that stack on top of one another. The horizontal division will be provisioned by block classes, with responsive layout switching that is customized for your content, not for your theme (-designer) or for an outdated wireframe.

In Drupal CMS Powerstart I added the block_class module and added a patch that assists in our responsive designing labours by auto-completing the Bootstrap 3 grid system classes. 

2.2 Bootstrap in Views

To use Bootstrap 3 in views we will use the views_bootstrap Drupal module. Let's take a look at how this module is used to create a Portfolio grid page for theDrupal CMS Powerstart Portfolio component.

powerstart-portoflio-grid-mock2.png

Live demo of portfolio grid.

The views_bootstrap module provides an array of new Views display plugins:

  • Bootstrap Accordion
  • Bootstrap Carousel
  • Bootstrap Grid
  • Bootstrap List Group
  • Bootstrap Media Object
  • Bootstrap Tab
  • Bootstrap Table
  • Bootstrap Thumbnails 

 

This grid of portfolio thumbnails uses the Bootstrap Grid views display plugin. The Bootstrap Grid plugin allows you to output any content in a grid using Bootstrap's grid html markup. A current shortcoming in the module is that it only allows you to select the number of columns for the 'large' media query. Fortunately, there is a patch for that:

https://www.drupal.org/node/2203111

The Drupal CMS Powerstart distribution has this patch included and uses it in views to create truly responsive grids, where you can set the number of columns per media query. It works quiet well out of the box. Here is the views format configuration used for the portfolio:

bootstrap-grid-views-plugin.jpg

As you can see it's real easy to create responsive views with this Views Bootstrap 3 integration! Without writing any code you can leverage the tried and tested responsive systems that are provided by Bootstrap. The views_bootstrap module gives you a whole set of tools that help you build responsive layouts and widgets using your trusted Views backend interface. This means site builders can rely less on themers/programmers and get work done quicker.

Using custom markup in views

The View Bootstrap module is great at organizing rows of data into responsive layouts, but it doesn't have the same level of support for fields inside a row of data. This is what we did to create a responsive events listing for the Drupal CMS Powerstart events component:

powerstart-events.jpg

Live demo of events view.

The events view uses the 'Unformatted list' plugin that is provided by the views module itself. This prints each row of data in a div container. There are 2 ways to make the contents of these rows responsive. One would be to generate node teasers inside the rows, and configure the content type's teaser display mode to use grid classes on the fields. This method will be covered in the next part of this tutorial. For the events view we don't use teasers, we are building a fields view because it gives us more flexibility in the fields we show in our view. Luckily the views interface makes it easy for us to add grid classes right where we need them. First, we will add a row class to each views row by clicking Settings under Format and adding row in the Row class field:

bootstap-rowclasses-views.jpg

Now we can add responsive column classes to our fields and they will be organized within each row. We simply add classes by clicking each field and editing the Style Settings CSS class field:

bootstap-classes-views.jpg

The only thing we need to do here is check the Create a CSS class checkbox, and a textbox will appear that allows us to add grid classes to the field. This field uses the class col-sm-6, which makes our event title use 50% of its parent container's width (because Bootstrap uses a 12 column grid) when on a small device. This means that on an extra small device there is not grid class active and the title will use 100% of it's parent container's width, as you can see in the mock-up above. We can't say this method is as easy as the point and click method discussed earlier but if you are familiar with the views interface already this method will become intuitive with a little bit of practice and will allow you to have very fine-grained control over responsive behaviors in your views.

2.3 Bootstrap in Fields

Often you want to organise content fields in a layout. A module that can be of help here is Display Suite, but even with the ds_bootstrap_layouts extension this will give you a limited set of layouts. We can easily build any layout by simply adding bootstral grid classes on fields. This is not to say I don't like Display Suite but since CMS Powerstart focuses on simplicity I will choose the simplest solution. 'Big' tools like Panels and Display Suite are definitely more appropriate for larger Drupal projects.

To make an example I will start building a new Drupal CMS Powerstart component. There was a feature request for a 'shop' component, so we will be building a content type as part of a simple component that will help brick and mortar shops display their inventory. First we will create a new content type called Object.  Since Bootstrap columns need to be wrapped in row classes, we are adding the field_group module. Once you have downloaded and enabled the field_group module, you will have a new option 'Add new group' under the manage fields tab of your Object content type. We are adding a group called Bootstrap row using the default widget fieldset. Now drag the image and body field to the indented position under the Bootstrap row field group. This will create a visual indication in the node/add and node/edit interface that fields belong to the same group. Your Manage Fields interface should now look like this:

bootstap-field-group.jpg

Next we will go to the Manage Display tab of the Object content type. This is where the Bootstrap magic happens. Our goal is to display the body text and image field beside eachother on big device and above one another in small devices. First, we have to create our Bootstrap row group again, this time we add a group named Bootstrap row and make it the 'Div' format. Give our field group the following configuration settings:

  • Fieldgroup settings: open
  • Show label: no
  • Speed: none
  • Effec none:
  • Extra CSS classes: row (you can remove the default classes)

Next we wil drag the Body and Image fields to the indented position under the field group. Now we simply configure the field formatters to use the Bootstrap grid classes of our choice. To add these classes in the Manage Display interface we are going to install another module: field_formatter_class. Once you have downloaded and enabled this module you can go back to the Manage Display interface and you will see an option to add a class on each field. You will now set both the Body and Image field to have the Field Formatter Class col-sm-6. This will create a 2 column layout on devices wider than 768px and a stacked layout on smaller devices. If you are using Drupal CMS Powerstart, you can set the Image style of your image field to Bootstrap 3 col6. This will resize the image to exactly fit the 6 column grid container.

Your Manage Display tab should now look like this: 

bootstap-field-group-display.jpg

Now if you create a node using your new content type it should look similar to this:

bootstap-field-group-node.jpg

Using our new fieldgroup tool we can easily add bootstrap rows and columns to any content type, and since classes are listed and edited in the Manage Fields interface, it's relatively quick and and easy to manage per-node layouts. At least it's a step up from managing a ton of node templates.

2.4 Bootstrap in Content: Shortcodes

Sometimes you (or a client) just want to create a special page that needs more attention than other pages of the same type. Unfortunately there aren't any free tools that give our clients a true WYSIWYG experience for creating responsive Bootstrap grids. If you know one please let me know! Our fallback option is the bs_shortcodes module that I ported from a Wordpres plugin. This module let's you add nearly all Bootstrap components, including grid elements, using a WYSIWYG-integrated form. 

To see the power and flexibility of what you can do with these shortcode check out this demo page:

http://glazed-demo.sooperthemes.com/content/responsive-columns

This system leverages the Drupal Shortcode API, which is a port of the Wordpress shortcode API. The Drupal CMS Powerstart distribution ships with a WYWISYG component that includes CKEditor 4 with the neccesary Shortcode API and shortcode-provisioning submodules. Since the configuration of this setup is complex and beyond the scope of this article I'm just going to assuming you are using Drupal CMS Powerstart and ready to use the WYSIWYG with Shortcodes integration.

To create a simple 2 column layout like in the previous examples we first add a row shortcode:

bootstrap-shortcode-row.png

Then we select the column shortcode and find the code that corresponds to 6 columns on a small devices:

bootstrap-shortcode-column.png

Now if we use 2 6 column shortcodes and put in the same content used in the Field and Field Group tutorial in will look like this in the editor:

bootstrap-shortcode-full.png

After saving the page it will look exactly as the Test Object page we created in the previous tutorial. I admit that shortcodes are a rather crude tool for a complex problem but anyone who is willing the learn the basic principles of a 12 column grid system will have a huge amount of flexibility and capability in creating responsive content. When you combine the Bootstrap 3 grid documentation, the WYSIWYG integration, and for emergencies the documentation of the Wordpress plugin you already have a fully documented tool for savvy clients who don't want to deal with raw HTML code. Shortcodes don't seem like the most userfriendly tool but I've seen clients pick it up quickly and appreciate the flexibility it gives them in organising their most important pages. In the future we migh see improvement in this area from tools like Visual Composer and the Drupal-compatible alternative Azexo Composer.

In Part 3 of this tutorial series I will write about using shortcodes as a site building tool and demonstrate what you can do with shortcodes in a real life Drupal CMS project. To get a sneak preview of the shortcode elements I will be using, check out our Drupal themes.

 

 

Tags planet drupal Bootstrap 3 Views Fields API Shortcodes cms powerstart Drupal 7.x
Catégories: Elsewhere

Drupal core announcements: Drupal 8 beta 5 on Wednesday, January 28, 2014

mar, 20/01/2015 - 15:36

The next beta for Drupal 8 will be beta 5! Here is the schedule for the beta release.

Tuesday, January 27, 2014 Only critical and major patches committed Wednesday, January 28, 2014 Drupal 8.0.0-beta5 released. Emergency commits only.
Catégories: Elsewhere

VM(doh): Be Careful with Large Select Lists on Drupal Commerce Line Item Type Configuration

lun, 19/01/2015 - 23:26

Recently, we were debugging some performance issues with a client's Drupal Commerce website. After doing the standard optimizations, we hooked up New Relic so we could see exactly what else could be trimmed.

The site is using different line item types to differentiate between products that should be taxed in different ways. Each line item type has a field where administrators can select the tax code to use for that line item type. The options for the select list are populated via an API call to another service provider. The call for the list was using the static cache because it was thought that the list would only be populated when needed on the line item type configuration page. In reality, that's not the case.

When an Add to Cart form is displayed in Drupal Commerce, it also loads the line item type and the line item type's fields. When loading the fields, it loads all of the options even if the "Include this field on Add to Cart forms for line items of this type" option is not enabled for that field. In this case, it resulted in 90 HTTP calls to populate the list of tax codes every time someone viewed a page with an Add to Cart form.

The solution was to actually cache those results using Drupal's Cache API. You can see the improvement:

Catégories: Elsewhere

InternetDevels: The module for changing login/registration form view

lun, 19/01/2015 - 11:16

While developing a site, we have been often faced with the task of changing the way the login form (authorization unit) is displayed. Previously, in such cases a css file was used. InternetDevels team has simplified this task by creating a “Сustomize login form” module. This tool allows to change the view of the site's authorization/registration/"Forgot your password?” forms using administration tool.

Read more
Catégories: Elsewhere

Web Omelette: Creating a custom Views field in Drupal 8

lun, 19/01/2015 - 09:10

In this article I am going to show you how to create a custom Views field in Drupal 8. At the end of this tutorial, you will be able to add a new field to any node based View which will flag (by displaying a specific message) the nodes of a particular type (configurable in the field configuration). Although I will use nodes, you can use this example to create custom fields for other entities as well.

So let's get started by creating a small module called node_type_flagger (which you can also find in this repository):

node_type_flagger.info.yml:

name: Node Type Flagger description: 'Demo module that flags a particular node type in a View listing' type: module core: 8.x

In Drupal 7, whenever we want to create a custom field, filter, relationship, etc for Views, we need to implement hook_views_api() and declare the version of Views we are using. That is no longer necessary in Drupal 8. What we do now is create a file called module_name.views.inc in the root of our module and implement the views related hooks there.

To create a custom field for the node entity, we need to implement hook_views_data_alter():

node_type_flagger.views.inc:

/** * Implements hook_views_data_alter(). */ function node_type_flagger_views_data_alter(array &$data) { $data['node']['node_type_flagger'] = array( 'title' => t('Node type flagger'), 'field' => array( 'title' => t('Node type flagger'), 'help' => t('Flags a specific node type.'), 'id' => 'node_type_flagger', ), ); }

In this implementation we extend the node table definition by adding a new field called node_type_flagger. Although there are many more options you can specify here, these will be enough for our purpose. The most important thing to remember is the id key (under field) which marks the id of the views plugin that will be used to handle this field. In Drupal 7 we have instead a handler key in which we specify the class name.

In Drupal 8 we have something called plugins and many things have now been converted to plugins, including views handlers. So let's define ours inside the src/Plugin/views/field folder of our module:

src/Plugin/views/field/NodeTypeFlagger.php

<?php /** * @file * Definition of Drupal\node_type_flagger\Plugin\views\field\NodeTypeFlagger */ namespace Drupal\node_type_flagger\Plugin\views\field; use Drupal\Core\Form\FormStateInterface; use Drupal\node\Entity\NodeType; use Drupal\views\Plugin\views\field\FieldPluginBase; use Drupal\views\ResultRow; /** * Field handler to flag the node type. * * @ingroup views_field_handlers * * @ViewsField("node_type_flagger") */ class NodeTypeFlagger extends FieldPluginBase { /** * @{inheritdoc} */ public function query() { // Leave empty to avoid a query on this field. } /** * Define the available options * @return array */ protected function defineOptions() { $options = parent::defineOptions(); $options['node_type'] = array('default' => 'article'); return $options; } /** * Provide the options form. */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $types = NodeType::loadMultiple(); $options = []; foreach ($types as $key => $type) { $options[$key] = $type->label(); } $form['node_type'] = array( '#title' => $this->t('Which node type should be flagged?'), '#type' => 'select', '#default_value' => $this->options['node_type'], '#options' => $options, ); parent::buildOptionsForm($form, $form_state); } /** * @{inheritdoc} */ public function render(ResultRow $values) { $node = $values->_entity; if ($node->bundle() == $this->options['node_type']) { return $this->t('Hey, I\'m of the type: @type', array('@type' => $this->options['node_type'])); } else { return $this->t('Hey, I\'m something else.'); } } }

We are defining our NodeTypeFlagger class that extends FieldPluginBase (which is the base plugin abstract class for the views field many plugins extend from). Just above the class declaration we use the @ViewsField annotation to specify the id of this plugin (the same one we declared in the hook_views_data_alter() implementation). We also use the @ingroup annotation to mark that this is a views field handler.

In our example class, we have 4 methods (all overriding the parent class ones).

Query

First, we override the query() method but leave it empty. This is so that views does not try to include this field in the regular node table query (since the field is not backed by a table column).

DefineOptions

The second method is the defineOptions() method through which we specify what configuration options we need for this field. In our case one is enough: we need to specify the node type which we want flagged in the Views results. We set a sensible default as the article node type.

BuildOptionsForm

The third method, buildOptionsForm() is responsible for creating the form for the configuration options we declared earlier. In our case we just have a select list with which we can choose from the existing node types.

Render

Lastly, the render() method which is the most important and which deals with output. We use it to actually render the content of the field for each result. Here is where we perform some business logic based on the currently set node type option and flag with a message whether or not the current result is in fact of the type specified in the configuration.

The $resultRow object is an instance of Drupal\views\ResultRow which contains data returned for the current row by Views and the entity object at the base of the query (in our case the node). Based on this information we can perform our logic.

Keep in mind you can use depedency injection to inject all sorts of services into this class and make use of them in your logic. Additionally, you can override various other methods of the parent class in order to further customize your field.

Conclusion

There you have it. A small custom module that demonstrates how to create a custom Views field (plugin). Relationships, filters, sorters and others work in similar way. I will be covering those in later articles. Stay tuned.

var switchTo5x = true;stLight.options({"publisher":"dr-8de6c3c4-3462-9715-caaf-ce2c161a50c"});
Catégories: Elsewhere

DrupalOnWindows: Node Comment and Forum working together to boost user participation

lun, 19/01/2015 - 07:00

It is frequent that customers approach us asking for help to rescue their projects from site builders. Sometimes they have technological issues (mainly slow sites) but sometimes it's just plain bad usability os some wrong marketing concepts.

We recently were asked for help from a site that gets about 5,000 unique visitors a day. Despite the not so bad visitor numbers for their niche, this page was getting very low user interaction. They barely got a handful (<10) of comments and forum posts in a whole year timespan.

Language English
Catégories: Elsewhere

Drupal core announcements: Drupal core security release window on Wednesday, January 21

lun, 19/01/2015 - 06:51
Start:  2015-01-21 (All day) America/New_York Online meeting (eg. IRC meeting) Organizers:  David_Rothstein

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

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, February 4.

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.

Catégories: Elsewhere

3C Web Services: Creating a Drag &amp; Drop Sorting Interface for a Drupal View

dim, 18/01/2015 - 21:45
How to create a drag and drop sorting interface for a Drupal 7 View.
Catégories: Elsewhere

Pages