Feed aggregator
Ryan Oles: Hubot Drush me Drupal
Recently the company I work for shifted the bulk of our instant message communications over to Campfire, and established a series of rooms to discuss our various projects. This transition seemed to go fairly well, once everyone settled on their preferred client interface. I was used to using IRC and found a nice little Ruby gem that piped Campfire through my IRC client. Chatting in this environment quickly had me missing Druplicon, the friendly Drupal fueled chat bot that tirelessly serves the Drupal IRC community. I decided to look for a replacement, and after some searching I stumbled upon Hubot, a Node.js powered chat bot. It was initially built by the folks at GitHub and includes a long list of plugin scripts added by community developers. This was immediately appealing for several reasons:
- It is built using Node.js
- It is written in Coffeescript (something I have wanted to try my hand at for a while)
- Additional scripts appeared easy to write, and plugin simply
- It has built in Campfire integration
So I installed Hubot on a small server, with a handful of scripts that I thought would be useful and fun for our team. Adding the bot to our Campfire rooms was fairly painless, and after writing a small init script we were good to go. This sparked some discussion among our team about how the bot was deployed, cool ways it could be extended, and methods of use. A fellow developer, David Fells, mentioned that it would be handy if we could tell Hubot to execute Drush commands. This gave me pause, and after a quick:
"That's a great idea! You mind if I implement that?"
"Sure, go for it."
I found myself firing up my editor, trying a few test methods, and reading up on CoffeeScript. Things moved fairly quickly, once I got going. I realized child_process.spawn()was going to be my friend, a core Node method that I had yet to use. Generally CoffeeScript proved to be the biggest challenge. While writing the initial prototype I actually used a JavaScript to CoffeScript translator and was cursing the whole time. However, by the time I was putting the finishing touches on my methods and objects I found myself smiling as I wrote in this almost comical syntax. Simply put, CoffeeScript is fun! I still find myself favoring the comforting structure of the curly braces and semicolons when working with JavaScript, but now that all seems somewhat gray and drab, knowing there is something much more playful out there.
As you can imagine there were, and are, several security concerns. The early prototype actually had user commands pipe right into Drush which is a security nightmare. Any user with access to the bot could escape or pipe in any old Bash command directly through the bot. Further, any Drupal installation that Drush is aware of would be at the mercy of users who may or may not have the best intentions at heart. Needless to say this approach was quickly abandoned in favor of a hand picked list of commands made available to the bot. This caused the code to be a bit more tedious, and likely less elegant, but I needed to insure that Drush would be executing the allowed commands, and nothing more. After some discussion I also decided to weed the available commands down to a relatively innocuous set (giving information vs. actually changing something). I attempted to structure the code in a way that it would not be difficult for another developer to add commands. Overall, I'm pretty happy with the end result, and the pull request was soon accepted. You can find this script along with all of the other Hubot scripts on GitHub.
tl;dr If you're looking for a fun chatbot for campfire (or otherwise) check out Hubot and enable drush.coffee if you'd like that bot to have cool Drush functionality.
Expresstut: Multiple file upload in drupal using plupload
In this tutorial we will be looking at how we can allow multiple file upload in drupal. To achieve this, we will be considering the plupload module. Plupload is a GPL licensed library used for multiple file uploading The plupload module allows backwards bend in other to achieve cross-browser compatibitility. using HTML5, flash, silverlight and even the classic HTML4 depending on the clients computer resources. Modules used for this tutorial. Filefield sources Filefiled sources plupload plupload
Open Source Training: The quickest, easiest way to test Drupal modules
One time consuming task for all software users is testing.
It takes time to find all the download links, to set up a test environment and to install all the additional software you need.
Simplytest.me is an ingenious solution for Drupal. Simplytest will install Drupal sites for you and also install and modules and themes that you want to use. Here's a brief introduction to this very useful site.
05/07 Overclockix .017
Friendly Machine: Custom Content Types and the Fields UI
One of the best things about Drupal is the ability to flexibly manage your content. If you're coming from a WordPress background, you'll know that system uses the Post and Page for its content types. In Drupal you have something similar in the Article and Basic page, but also an easy to use interface for creating a virtually unlimited number of other content types.
Before we get into the how, let's briefly discuss why we would want to use custom content types. Some of you may be thinking to yourselves that you've been getting along very nicely without additional content types. Whenever you've needed to organize your content, you've always had your taxonomy terms handy.
Although taxonomy terms (the equivalent of Categories in WordPress) are very useful, they don't solve the same problem as content types. Let's break away for a moment from the idea of our site consisting of pages and instead think of it as being comprised of objects. Of course we still have objects we call pages, but we may also find that our site has other types of objects like products, events, and forum topics.
Ultimately, all of our objects may be expressed as web pages, but they represent different types of things. We can use Drupal's custom content types and the Fields UI to define these objects and give a more logical structure to our site's content.
Now you may be asking about those taxonomy terms...where do they fit in? Taxonomy terms simply help us differentiate between the variations we find within our objects. For example, a bicycle and a shirt are both products, but certainly quite different. So we can use taxonomy terms to essentially create sub-categories within our content types. In a future lesson in this series we'll take a closer look at taxonomy in Drupal.
Creating a Custom Content TypeNow that we have an idea of why we would want a new content type, let's create one called "Product" for our example site. We'll begin by going to Structure > Content types. You should see something like the screenshot below.
You'll see a link at the upper left that says, "Add content type". Go ahead and click that link. You'll be directed to the screen below where we can define our new content type.
The name and description fields are pretty self explanatory, but we'll briefly go through the other fields in the tabs at the bottom of the form.
Submission form settings
You see three settings under this tab. The first is "Title field label". This is what content creators will see when creating a new piece of content and by default it's set to, "Title". Frequently with custom content types, this isn't as descriptive as we would like. In our case we should change it to something like, "Product name".
The second setting controls preview options and the last one allows you to create a message that will be displayed at the top of the page providing submission guidelines. This can be very useful if the content type you are creating will be user-generated content.
Publishing options
These setting help you determine the default status of the post when you click 'Save'. For example, should the post be automatically published? Should it be promoted to the front page? If you have the Revisioning module installed you will also see options for creating a new revision - very handy if you want to be able to roll back any changes.
Display settings
You can disable the display of the author and post date information by unchecking this box.
Comment settings
This is where you can adjust the settings for the comments on your site. I personally recommend you consider disabling Drupal comments and use a third party commenting system. I've talked about this in a recent post, but suffice it to say there are significant advantages to not using Drupal's built-in comments.
Menu settings
With this setting, you can optionally make your content assignable to the any menus you may have created for your site.
XML sitemap
This setting isn't present in Drupal by default, but is found in our example site because using a sitemap is such an important - and in my view, fundamental - part of building a website. However, there are times when you may not want a content type indexed by search engines and here is where you can disable that if needed.
Custom breadcrumbs
This is another one that isn't included by default with Drupal, but also very useful for most sites. It exposes the custom breadcrumb information on the node edit form.
For most of these settings, we'll stick with the defaults. Once we've given our content type a name we'll click the "Save and add fields" button at the bottom of the form. You should then see something similar to the image below.
The Fields UIThe image above is the Fields UI, the administrative interface for adding and configuring the fields for your content types. There are a few fields here that have been added by modules that are installed with the example site (Meta tags, for example) and two that are included by default by Drupal. The default fields are Title - in our case renamed to Product name - and Body.
What we're going to do next is add a new field. Since we're adding a content type for our products, Price seems like a logical field to start with.
You'll notice in the area highlighted in green how we have the form filled out. Our Field type is set to decimal and we've chosen a text box for the widget - aka input element - that will appear on the node create form for our content type. Let's go ahead and click Save to continue.
The next screen (not shown) allows us to set the precision of our decimal number as well as how many digits should be to the right of our decimal point. We've kept these at the defaults and continued to the screen below.
We won't go over each of these, but an important point to keep in mind is that these settings will change depending on the content type you set for the field. For example, if you chose the field to be an image, you would have settings for allowable formats, maximum and minimum sizes, as well as for which image style you wanted to use.
In this particular example, one field we may want to change would be the prefix. Maybe setting it to the dollar sign (or pound, euro, etc.) might be a good idea. Let's do this and then click save. You'll then see that our field has been added to our content type and we can change its position on the node create/edit form by dragging it up or down our list of fields.
Before we move on we should briefly note that you can also reuse fields that you may have defined previously using the, "Add existing field" component. One situation where this may come in handy is for an image field. Instead of having multiple image fields, you could reuse a single field for all of your content types and control the display of the image using image styles. Sometimes this may not be what you need, but in general it's a good practice because it will make things less confusing as your site grows in complexity.
Managing DisplayThe final thing we'll discuss is managing the display of our fields. You'll see a tab on the page titled, "Manage Display". The settings on that tab are pretty straightforward so I won't go into too much detail, but something that new site builders sometimes do is forget to hide the display of the label for certain fields, in particular, those for images. This tab is where you can remove the label for those images as well as other aspects of how the fields for the content type will be displayed on your nodes (aka web pages).
That's it for our discussion of content types and the fields UI. There is a lot going on, but fortunately it is pretty intuitive to use, particularly once you've got a handle on what is happening conceptually. Next time we're going to take a look at using Views - a big and very important topic! If you'd like to keep up to date on this series, you can subscribe to the RSS feed.
In the meantime, if you'd like to comment on this post, you can do so on this discussion forum.
LevelTen Interactive: Drupal Learning Curve too Steep for the Weak
I am sick and tired of hearing that the Drupal learning curve is a much steeper than the WordPress learning curve. The reality is, both platforms are starting to converge in several areas.... Read more
Open Source Training: Move a Drupal Site to a New Folder
Moving a Drupal site to a new location on your server is surprisingly easy.
There is a simple 3 step process to move a Drupal site from one folder to another. In this tutorial we're going to show you those 3 steps.
If you'd like to move a Drupal site to new folder, we recommend using the Backup and Migrate module.
Propeople Blog: Introduction to Service Guzzle module
Nowadays Drupal Services support becomes stronger and more flexible. The main functionality is provided by Services module. You can find more than 1300 modules tagged with “services” that is more than enough :).
Out of the box services provides just REST/RCP server and pure documentation of available options. But sometimes we need to build Client instance to retrieve data from another Drupal env that provides for example RESTful server. You have some ways to implement it:
- Custom handmade solution, built using services source only
- Use “Services Documentation” or “Services API” modules to get more useful info to build your own handmade Client instance :)
- Use contrib modules which provides already created Client instance like Services Client or Services Guzzle!
I prefer to use ready, tested solutions, not to reinvent the wheel and save my time :) Meet Services Guzzle module. It brings power of Guzzle framework to Services module, also Guzzle is already part of D8. The module provides three things:
- Generate Guzzle Service Description from endpoint definition.
- Example of Guzzle Client instance implementation and usage.
- GUI for Client debugging
Guzzle Service Description
Guzzle has really amazing feature - factory method to create Client instance from Guzzle description. You can read about it here. So the main job of our module is generate this description for particular endpoint object. For example we have endpoint “Node service” that provides all node operations: retrieving, creating, deleting, etc. SG (let make a shortcut for Services Guzzle module) create an additional tab for endpoints that looks like:
Here we can see Guzzle version of endpoint object in JSON format, that is even human-readable :) Now we have two ways to create a Guzzle Client (see on DrupalServicesClient class in the services_guzzle_client submodule):
- Create service.json file and put Guzzle description json string there, then this lovely piece of code will create ready-to-work instance: $client = \DrupalServices\DrupalServicesClient::factory(array('includes' => array($path_to_json . '/service.json'));
- Provide array with this description and use $client = \DrupalServices\DrupalServicesClient::factory($array_of_service_description);
That’s all, now you have full Guzzle Client object!
Guzzle Client usage
Now when we have a Guzzle Client lets see how it works. If you return to Guzzle endpoint service description json you will find array of operations like "NodeOperationRetrieve" or "NodeOperationCreate". Inside every operation there are some other options, but now we need only “parameters”. So for NodeOperationRetrive we need name of operation and param - “nid”. Lets use our Client to retrieve a node:
$arguments = array('nid' => 1);
$command = $client->getCommand('NodeOperationRetrieve', $arguments);
$response = $client->execute($command);
And if node with given id exists we will get node data into $response variable. Did you notice that it is template of using any operation provided by your endpoint. Just change operation name and arguments :) For example updating node:
$arguments = array('nid' => 1,
‘node’ => array(‘title’ => ‘Modified title’));
$command = $client->getCommand(NodeOperationUpdate, $arguments);
$response = $client->execute($command);
Gui for Guzzle client debugging
Service Guzzle Client provide example of usage and also UI to test and debug your local endpoint or external from given service description. After you choose one of these options you will get a list of available operations to test.
Use “UserOperationRetrieve” for example. Some operations will need Authorize first, it depends on your permissions. SG UI provides form for auth every time. So for UserOperationRetrieve we have such separate page with form:
And if you provide valid credentials and existed user id you will get the full user object via dpm theme (so familiar for Drupal developers). Also you will get the full exception message if some occurs.
Service Guzzle module introducing is over :) Waiting for feedback.
Language English Tags: DrupalDevelopmentTutorialsCheck this option to include this post in Planet Drupal aggregator: planetDrupal Commerce: Commerce Module Tuesday: Commerce Reporting
Welcome to another Commerce Module Tuesday! Today we are looking at Commerce Reporting, maintained by Christophe Van Gysel who interned at Commerce Guys last year and is now interning at Google in the United States (yes, we’re all jealous of Christophe). Get ready for a high impact and extremely useful module, folks. It not only “just works” it takes all of it’s data from the existing database and displays fancy graphs and filterable reports. In other words, even if your store was built on a pre-beta Commerce from 2011, this module would still be able to read your store history.
Christophe had to really jump a number of hurdles to get this module launched last year, not the least of which was a lack of community consensus on how to display graphs from Views 3.x on Drupal 7. So he built the Visualization API which has now eclipsed commerce_reports in terms of active installs. So, as a part of another Commerce Module Tuesday, I invite you to sit back and take a look at another awesome community contributed module that fills a vital role: data mining.
Digett: Everplans: Behind the Curtain
Everplans.com is a website meant to help people prepare for and deal with death. The previous iteration of their site presented numerous technical challenges, making it difficult for their team to achieve their goals. It became Digett's job to give Everplans a website that works for, not against, its users and administrators.
Mediacurrent: Preparing for Solr in four easy steps
Apache Solr is a Java application that gives you a more full featured search experience than the default Drupal search. It provides tools to allow your users to narrow down the search results and adjust the sorting. Solr can be very confusing initially due to the new terms it introduces as well as the sheer number of configuration options. This guide helps you plan out the items that you need to think about before you ever install the module.
Don't worry if this doesn't make sense, we have an upcoming webinar that should help fill in all the blanks. Be sure to check out our free Intro to Solr in Drupal webinar.
Rick Manelius: Drupal PCI Compliance White Paper: Update 5/5/2013
For context, click here to jump down to the reference links.
Where We AreI'm pleased to announce the following:
- My co-authors and I have completed a rough draft of this white paper and we're actively refining it to get to a completed first draft.
- Ned McClain of Applied Trust has joined the project as a co-author. Ned's expertise and years of experience in this field has been an extremely valuable asset and this project will continue to benefit as a direct result of his input.
- A heartfelt thanks to Ryan Cross of CrossFunctional for becoming our latest project sponsor.
- The article that sparked this project (Let's Talk About PCI Compliance for Ubercart and Drupal Commerce) has crossed 2500 page views. This reinforces (at least to me) that there is a demand for more information on this subject matter.
- The number of reported Ubercart/Drupal Commerce installations continues to grow rapidly.
- Many "silver bullet" strategies are not as bulletproof as you'd like to believe.
- A new version of the PCI standard will be released within a year and the requirements are only going to get more stringent.
- As companies become more distributed and adopt cloud-based solutions, it's important to define who is responsible (and liable) in the context of securing payments.
- Fully understanding this topic can give you and/or your business a competitive advantage in the Drupal ecommerce marketplace.
And perhaps the most important item—if you currently own, operate, or host an ecommerce website that is NOT compliant, you could be putting your business at risk.
Next StepsThis is a complex topic that requires a lot of time to check assumptions, distill a large volume of material down to the most important elements, and write it in a way that is understandable across several audiences within the community. Having nearly achieved a fully complete first draft, we are at the stage where we will need to iterate and refine it to ensure its one cohesive document and it has all the necessary components (most notably references, citations, and footnotes). We will then reach out to additional reviewers to get feedback from a wider audience. If all goes as planned, this feedback will only require us to make minor adjustments and we will have a clear path forward to a final release.
SponsorshipThere are still several gold and silver sponsorships available if you are willing and able to fund the remaining portions of this project. While a lot of progress has been made, I recall several personal (and painful) experiences submitting manuscripts to scientific journals only to find out that the quantity of revisions requests required rewriting a paper from scratch. Yes, this can be disheartening, but it almost always resulted in a much better end product. Therefore, if you would like to become a sponsor, please reach out to me using the contact information at the official website for the white paper.
Thank you for your time and I look forward to contributing this work back to the community!
ReferenceThe following articles, posts, and websites describe the motivating factors for starting this project:
- Let's Talk About PCI Compliance for Ubercart and Drupal Commerce
- Proposal: Drupal PCI Compliance White Paper
- Drupal PCI Compliance White Paper (Official Website)
Web Wash: Create Multiple Nodes From A Single Page
The Multi Node Add module provides an interface for creating multiple pieces of content easily from a single page. The module is a time saver for content creators who often enter in a large amount of articles and pages. Using Multi Node Add is fairly straight forward, just enable the module and then go to /multi_node_add to create content.
05/07 FuguIta 5.3
05/06 Parabola 2013.04.27
05/06 Wifislax 4.4-rc1
05/06 elementary 0.2-beta2
Modules Unraveled: Audioblog: Who are new contributors? What leeway do we give them?
The following blog post was written by Cathy Theys of comm-press, and is also read by Cathy Theys. You can find the original article where you can comment, and find all of the links mentioned in the blog on the Comm Press blog. Enjoy!
Tags: Audioblog, planet-drupal5 Rings: Creating a Plan - The Art of the Definition Document
How to plan a Drupal Project
When a client comes to you with an amazing idea for the project that is going to change EVERYTHING in a market, enthusiasm for getting down and building before thinking through how that goal might be achieved is very common. You may get a "plan" on the back of napkin. There are a few approaches that you can take to reach the client's ultimate goal.
Linnovate: AngularJS & Drupal
Angularjs is a refreshing javascript framework created and promoted by Drupal and is one of those open source projects (like Drupal) where you simply know will be around for the next 4-5 years and are about to leave a dent in the open web space.
The beauty (as in most javascript MVC frameworks) is how it organizes the different parts of the application (views, controllers, services..) and enforces it's opinionated view of how things work and why.
This lets you build complex single page applications in a predictable and standardized way.
It also presents an interesting approach on how to address some of the more common customer scenarios..
We have seen many customers that are stuck in some kind of Drupal Hell with codebase from Drupal 5 stuck in time because their original developer hacked core or views and they never had the budget to upgrade.
It's extremely challenging to provide value to this type of customer but we've found an interesting pattern using Angularjs to create modern cutting edge interfaces even within the weirdest sphagetticoded nightmares.
So let's say we have a Drupal5 site stuck in 2008...
- Create a content type called angularapp
- Overide page.tpl.php as page-node-angularapp.tpl.php (Drupal 5 needed custom code in template.php
- Load the angular.js library and dependencies plus your apps code
- Comment out the print of the $content in you're overiden template and instead add
- The code above renders the angular app based on the code
<section ng-app="appname"><div ng-view></div></section>
The idea is to replace the rendering of $content all together when the angularjs is rendered.
Is there anybody out thereIt doesn't matter how much amount of frontend wizardry goes on we still need someone to answer those angular services and provide the frontend with the data coming from the Drupal site.
For the Angular curious - I created a gist (rendered belowe) - walking through the relevant steps in an angular app -
https://gist.github.com/liorkesos/5528234

