Planet Drupal

Syndicate content - aggregated feeds in category Planet Drupal
Updated: 30 min 19 sec ago

Deeson Online: Using Grunt, bootstrap, Compass and SASS in a Drupal sub theme

Mon, 08/18/2014 - 08:37
div class=field field-name-body field-type-text-with-summary field-label-hiddendiv class=field-itemsdiv class=field-item even property=content:encodedstyle type=text/css !--/*--![CDATA[/* !--*/ pre { padding: 10px; width: 560px; } .post .meat p img:nth-child(n+1), .copy-jump-out p img:nth-child(n+1) { margin-left: 0; } /*--!]]*/ /stylepIf you have a separate front end design team from your Drupal developers, you will know that after static pages are moved into a Drupal theme there can be a huge gap in structure between the original files and the final Drupal site./p pWe wanted to bridge the gap between our theme developers, UX designers, front end coders, and create an all encompassing boilerplate that could be used as a starting point for any project and then easily ported into Drupal./p pAfter thinking about this task for a few weeks it was clear that the best way forward was to use Grunt to automate all of our tasks and create a scalable, well structured sub theme that all of our coders can use to start any project./p h3What is Grunt?/h3 pGrunt is a Javascript task runner that allows you to automate repetitive tasks such as file minifying files, javascript linting, CSS preprocessing, and even reloading your browser./p pJust like bootstrap, there are many resources and a vast amount of plugins available for Grunt that can automate any task you could think of, plus it is very easy to write your own, so setting Grunt as a standard for our boilerplate was an easy decision./p h3The purpose of this post/h3 pWe use bootstrap in most projects and recently switched to using SASS for CSS preprocessing bundled with Compass, so for the purpose of this tutorial we will create a simple bootstrap sub theme that utilises Grunt amp; Compass to compile SASS files and automatically reloads our browser every time a file is changed./p pYou can then take this approach and use the best Grunt plugins that suit your project./p h3Step 1. Prerequisites/h3 pTo use Grunt you will need node.js and ruby installed on your system. Open up terminal, and type:/p pre style=background:#fff;color:#000 node span style=color:#00f;font-weight:700-/spanv /prepre style=background:#fff;color:#000 ruby span style=color:#00f;font-weight:700-/spanv /prepIf you don't see a version number, head to the links below to download and install them./p pDon’t have node? a href= target=_blankDownload it here/a/p pDon’t have ruby? a href= target=_blankFollow this great tutorial/a/p h3Step 2. Installing Grunt/h3 pOpen up terminal, and type:/p pre style=background:#fff;color:#000 sudo npm install -g grunt-cli /prepThis will install the command line interface for Grunt. Be patient whilst it is downloading as sometimes it can take a minute or two./p h3Step 3. Installing Compass and Grunt plugins/h3 pBecause we want to use the fantastic set of mixins and features bundled with Compass, lets install the Compass and SASS ruby gems./p pOpen up terminal, and type:/p pre style=background:#fff;color:#000 sudo gem install sass /prepre style=background:#fff;color:#000 sudo gem install compass /prepFor our boilerplate we only wanted to install plugins that we would need in every project, so we kept it simple and limited it to Watch, Compass and SASS to compile all of our files. Our team members can then add extra plugins later in the project as and when needed./p pSo lets get started and use the node package manager to install our Grunt plugins./p pSwitch back to Terminal and run the following commands:/p pre style=background:#fff;color:#000 sudo npm install grunt-contrib-watch —save-dev /prepre style=background:#fff;color:#000 sudo npm install grunt-contrib-compass —save-dev /prepre style=background:#fff;color:#000 sudo npm install grunt-contrib-sass —save-dev /preh3Step 4. Creating the boilerplate/h3 pNote: For the purposes of this tutorial we are going to use the bootstrap sub theme for our Grunt setup, but the same Grunt setup described below can be used with any Drupal sub theme./p ul liCreate a new Drupal site/li liDownload the bootstrap theme into your sites/all/themes directorybr / pre style=background:#fff;color:#000 drush dl bootstrap /pre/li liCopy the bootstrap starter kit (strongsites/all/themes/bootstrap/bootstrap_subtheme/strong) into your theme directory/li liRename /strongtostrong liNavigate to strongadmin/appearance/strong and click “strongEnable, and set default/strong for your sub-theme./li /ul pYour Drupal site should now be setup with Bootstrap and your folder structure should now look like this:/p pimg alt= src=/sites/default/files/uploads/subtheme-structure.jpg style=width: 404px; height: 271px; //p pFor more information on creating a bootstrap sub theme check out the a href= target=_blankcommunity documentation/a./p h3Step 5. Switching from LESS to SASS/h3 pOur developers liked less, our designers likes SASS, but after a team tech talk explaining the benefits of using SASS with Compass (a collection of mixins with an updater with some cleaver sprite creation), everyone agreed that SASS was the way forward./p pOfficially Bootstrap is now packaged with SASS, so lets replace our .less files with .scss files in our bootstrap_subtheme so we can utilise all of the mixin goodness that comes with it SASS amp; Compass./p ul liHead over to bootstrap and a href= target=_blankdownload the SASS version/a/li liCopy the strongstylesheets/strong folder from strongboostrap-sass/assets//strong and paste it into your strongbootstrap_subtheme/strong/li liRename the strongstylesheets/strong folder to strongbootstrap-sass/strong/li liCreate a new folder called strongcustom-sass/strong in strongbootsrap_subtheme/strong/li liCreate a new file in the strongcustom-sass/strong called strongstyle.scss/strong/li liImport strongbootstrap-sass/bootstrap.scss/strong into strongstyle.scss/strong/li /ul p​You should now have the following setup in your sub theme:br /img alt= src=/sites/default/files/uploads/grunt-style-css.png style=width: 672px; height: 233px; //p p class=p1span class=s1We are all set!/span/p h3Step 6. Setting up Grunt - The package.json amp; Gruntfile.js/h3 pNow lets configure Grunt to run our tasks. Grunt only needs two files to be setup, a package.json file that defines our dependencies and a Gruntfiles.js to configure our plugins./p pWithin bootstrap_subtheme, create a package.json and add the following code:/p pre style=background:#fff;color:#000 { span style=color:#036a07name/span: span style=color:#036a07bootstrap_subtheme/span, span style=color:#036a07version/span: span style=color:#036a071.0.0/span, span style=color:#036a07author/span: “span style=color:#00f;font-weight:700Your/span span style=color:#00f;font-weight:700Name/spanspan style=color:#036a07, /spanhomepagespan style=color:#036a07: /spanhttp:span style=color:#06f;font-style:italic//,/span span style=color:#036a07engines/span: { span style=color:#036a07node/span: span style=color:#036a07gt;= 0.8.0/span }, span style=color:#036a07devDependencies/span: { span style=color:#036a07grunt-contrib-compass/span: span style=color:#036a07v0.9.0/span, span style=color:#036a07grunt-contrib-sass/span: span style=color:#036a07v0.7.3/span, span style=color:#036a07grunt-contrib-watch/span: span style=color:#036a07v0.6.1/span } }/prepimg alt= src=/sites/default/files/uploads/package-json.png style=color: rgb(34, 34, 34); font-family: Arial, Verdana, sans-serif; width: 672px; height: 255px; //p pIn this file you can add whichever plugins are best suited for your project, check out the full list of plugins at the official a href= target=_blankGrunt site/a./p h3Install Grunt dependencies/h3 pNext, open up terminal, cd into strongsites/all/themes/bootstrap_subtheme/strong, and run the following task:/p pre style=background:#fff;color:#000 sudo npm install /prepThis command looks through your strongpackage.json/strong file and installs the plugins listed. You only have to run this command once when you set up a new Grunt project, or when you add a new plugin to strongpackage.json/strong./p pOnce you run this you will notice a new folder in your strongbootstrap_subtheme/strong called strongnode_modules/strong which stores all of your plugins. If you are using git or SVN in your project, make sure to ignore this folder./p pNow lets configure Grunt to use our plugins and automate some tasks. Within strongbootstrap_subtheme/strong, create a strongGruntfile.js/strong file and add the following code:/p pre style=background:#fff;color:#000 span style=color:#6d79de;font-weight:700module/span.span style=color:#0000a2;font-weight:700exports/span span style=color:#687687=/span span style=color:#00f;font-weight:700function/span (grunt) { grunt.initConfig({ watch: { src: { files: [‘span style=color:#687687*/spanspan style=color:#687687*/spanspan style=color:#06f;font-style:italic/*.scss', '**//spanspan style=color:#687687*/span.phpspan style=color:#036a07'], tasks: ['/spancompass:devspan style=color:#036a07'] }, options: { livereload: true, }, }, compass: { dev: { options: { sassDir: '/spancustomspan style=color:#687687-/spansass/scssspan style=color:#036a07', cssDir: '/spancssspan style=color:#036a07', imagesPath: '/spanassets/imgspan style=color:#036a07', noLineComments: false, outputStyle: '/spancompressedspan style=color:#036a07' } } } }); grunt.loadNpmTasks('/spangruntspan style=color:#687687-/spancontribspan style=color:#687687-/spancompassspan style=color:#036a07'); grunt.loadNpmTasks('/spangruntspan style=color:#687687-/spancontribspan style=color:#687687-/spansassspan style=color:#036a07'); grunt.loadNpmTasks('/spangruntspan style=color:#687687-/spancontribspan style=color:#687687-/spanwatchspan style=color:#036a07'); }; /span/prepThis file is pretty straight forward, we configure our watch tasks to look for certain files and reload our browser, and then we define our scss and css directories so that compass knows where to look./p pI won’t go into full detail with the options available, but visit the links below to see the documentation:/p pa href= target=_blankWatch documentatation/a/p pa href= target=_blankSASS documentatation/a/p pimg alt= src=/sites/default/files/uploads/gruntfile-js.png style=width: 709px; height: 447px; //p p /p h3Step 7. Enabling live reload/h3 pDownload and enable the livereload module into your new Drupal site. By default, you will have to be logged in as admin for live reload to take effect, but you can change this under Drupal permissions./p pOnce you enable livereload, refresh your browser window to load the livereload.js library./p h3Step 8. Running Grunt/h3 pWe are all set! Head back over to Terminal and check you are in the bootstrap_subtheme directory, then type:/p pre style=background:#fff;color:#000 grunt watch /prepimg alt= src=/sites/default/files/uploads/waiting.png style=width: 470px; height: 213px; //p pNow every time you edit a scss file, Grunt will compile your SASS into a compressed style.css file and automatically reload your browser./p pGive it a go by importing compass into the top of your style folder and changing the body background to be a compass mixin./p pre style=background:#fff;color:#000 span style=color:#00f;font-weight:700@import/span span style=color:#036a07'compass'/span; span style=color:#00f;font-weight:700@import/span span style=color:#036a07'../bootstrap-sass/bootstrap.scss'/span; span style=color:#06f;font-style:italic/* * Custom overrides *//span span style=font-weight:700body/span { @include span style=color:#6d79de;font-weight:700background/span(linear-gradient(#eee, #fff)); } /prepimg alt= src=/sites/default/files/uploads/sass-grunt-import.png style=width: 843px; height: 236px; //p pTo stop Grunt from watching your files, press strongCtrl/strong and strongC/strong simultaneously on your keyboard./p h3Step 9. Debugging/h3 pOne common problem you may encounter when using Grunt alongside live reload is the following error message:/p pre style=background:#fff;color:#000 Fatal error: Port 35729 is already in use by another process. /prepimg alt= src=/sites/default/files/uploads/fatal-error.png style=width: 470px; height: 213px; //p pThis means that the port being used by live reload is currently in use by another process, either by a different grunt project, or an application such as Chrome./p pIf you experience this problem run the following command and find out which application is using the port./p pre style=background:#fff;color:#000 lsof | grep 35729 /prepSimply close the application and run “grunt watch” again. If the error still persists and all else fails, restart your machine and try to stop Grunt from watching files before moving on to another project./p h3Next steps…/h3 pThis is just a starting point on what you can achieve using Grunt to automate your tasks and gives you a quick insight to how we go about starting a project./p pOther things to consider:/p ul liDuplicating the strong_variables.scss/strong bootstrap file to override the default settings./li liAdding linted, minified javascript files using the a href= target=_blankuglify plugin/a/li liConfigure Grunt to automatically validate your markup using the a href= target=_blankW3C Markup Validator/a/li liWrite your own Grunt plugins to suite your own projects/li /ul h5Let me know your thoughts - you can share your ideas and views in the comments below./h5 p /p /div/div/divdiv class=field field-name-node-link field-type-ds field-label-hiddendiv class=field-itemsdiv class=field-item evena href=/labs/using-grunt-bootstrap-compass-and-sass-drupal-sub-themeRead more/a/div/div/divdiv class=field field-name-title field-type-ds field-label-hiddendiv class=field-itemsdiv class=field-item even property=dc:titleh2Using Grunt, bootstrap, Compass and SASS in a Drupal sub theme/h2/div/div/divdiv class=field field-name-meta field-type-ds field-label-hiddendiv class=field-itemsdiv class=field-item evenBy a href=/category/author/david-allardDavid Allard/a | 18th August 2014/div/div/div

Victor Kane: Super simple example of local drush alias configuration

Sun, 08/17/2014 - 16:12
!-- google_ad_section_start --pSo I have a folder for drush scripts _above_ several doc root folders on a dev user's server. And I want to run status or whatever and my own a href= target=_blankcustom drush scripts/a on _different_ Drupal web app instances. Drush has alias capability for different site instances, so you can do:/p p$ drush @site1 status/p pSo, how to set up an aliases file?/p p(I'm on Ubuntu with Drush 6.2.0 installed with PEAR as per this great d.o. doc page a href= target=_blankInstalling Drush on Any Linux Server Out There/a (a href= target=_blankKalamuna/a people, wouldn't you know it?))./p pCareful reading of the a href= drush documentation/a points you to a a href= target=_blankDrush Shell Aliases/a doc page, and from there to the actual a href= target=_blankexample aliases file/a that comes with every drush installation./p pSo to be able to run drush commands for a few of my local Drupal instances, I did this:/p ul liIn my Linux user directory, I created the file ~/.drush/aliases.drushrc.php/li liContents:/li /ul prelt;?php $aliases['site1'] = array( 'root' =gt; '/home/thevictor/site1/drupal-yii', 'uri' =gt; '', ); $aliases['site2'] = array( 'root' =gt; '/home/thevictor/site2', 'uri' =gt; '', );/prepThen I can do, from anywhere as long as I am logged in as that user:/p pre$ cd /tmpbr /$ drush @site1 statusbr / /$ drush @site2 status/prepand lots of other good stuff. Have a nice weekend./p p/p!-- google_ad_section_end --div class=og_rss_groups/divpa href= target=_blankread more/a/p

Wesley Tanaka: Fast, Low Memory Drupal 6 System Module

Sat, 08/16/2014 - 03:24
pA a rel=nofollowDrupal 5 version of this module/a is also available.nbsp; If you would like this patch to be committed to Drupal core, please do not leave a comment on this page—please instead add your comment to a rel=nofollow target=_blank href= issue #455092/a./p pThis is a drop-in replacement for the codesystem.module/code of Drupal 6.33 which makes your Drupal 6 sitenbsp;a rel=nofollowuse less memory/a and may even make it faster. A test I ran in a development environment with a stock Drupal 6 installation suggested that I got:/ppa rel=nofollow target=_blank href= more/a/p

Mediacurrent: Join Mediacurrent for These Drupal and Digital Marketing Events

Fri, 08/15/2014 - 22:16
img typeof=foaf:Image src= width=200 height=152 / pSome Mediacurrent's top talent will be leading discussions on the latest developments in Drupal and digital marketing trends in many upcoming events. Check out the links below for more information and to register. We hope to see you there and make sure you stop by and say “hello”!/p

Drupal @ Penn State: Drupal, Singularity, Digital Activism, and saving our institutions

Fri, 08/15/2014 - 19:51
div class=field field-name-body field-type-text-with-summary field-label-hiddendiv class=field-itemsdiv class=field-item even property=content:encodedpIt is as important to tell a great story using technology as it is to author technology that allows more stories to be told./p/div/div/div

Acquia: New Commons Media Integration

Fri, 08/15/2014 - 16:22
div class=field field-name-body field-type-text-with-summary field-label-hidden div class=field-items div property=content:encoded class=field-item evenpDrupal is known for providing a broad range of functionality with its extensible core and the tens of thousands of free contributed modules which add or extend functionality. One challenge for people who are building applications on top of Drupal is taking advantage of this flexibility and broad range of available functionality without compromising the usability of their applications for end users, and even for themselves as site maintainers. /p/div /div /div span property=dc:title content=New Commons Media Integration class=rdf-meta/span

Four Kitchens: Frontend roundup: DrupalCon Amsterdam

Fri, 08/15/2014 - 15:50
div class=field-body pAs many of you might know, I am now on the other side of the pond, so I#8217;ve paid extra attention to the DrupalCon Amsterdam schedule as it has been coming together. I want to highlight a few frontend goodies that I#8217;m particularly excited tonbsp;see./p /div div class=field-blog-categories-term-tree a href=/topics/drupalcon typeof=skos:Concept property=rdfs:label skos:prefLabel datatype=DrupalCon/a /div div class=field-blog-categories-term-tree a href=/topics/sass typeof=skos:Concept property=rdfs:label skos:prefLabel datatype=Sass/a /div div class=field-blog-categories-term-tree a href=/topics/css typeof=skos:Concept property=rdfs:label skos:prefLabel datatype=CSS/a /div div class=field-blog-categories-term-tree a href=/topics/javascript typeof=skos:Concept property=rdfs:label skos:prefLabel datatype=JavaScript/a /div div class=field-blog-categories-term-tree a href=/topics/drupal typeof=skos:Concept property=rdfs:label skos:prefLabel datatype=Drupal/a /div

Mediacurrent: Responsive Web Design using Sass at Drupalcamp Los Angeles

Fri, 08/15/2014 - 14:44
img typeof=foaf:Image src= width=200 height=152 / pI'm very excited to be a featured speaker at this year'sa href= DrupalCamp Los Angeles/a on Saturday, September 6th and Sunday, September 7th. This event, held at annually at the conference center at the University of California, Irvine, is a free event for the Drupal Community of Los Angeles, Orange County, and the Greater Southern California area. My session will focus on Responsive Web Design using Sass./p Frontend United copenhagen 2014

Fri, 08/15/2014 - 12:29
!--content-field.tpl-- div class=fieldgroup group-image div class=content !--content-field.tpl-- /div /div pWelcome back from your summer vacation. Now its time to get out of the sun, and get indoors and geeking out!br / Its gonna be the fifth time for Frontend Drupal Badass'es that we gather and discuss amp; talk Drupal Frontend. We have done this since 2010 (Prague, Berlin, Amsterdam, London) and now its time for the bike loving city of copenhagen to again host a little Drupal Event./p pa href= target=_blankread more/a/p

IXIS: We are 10 today - A look back

Fri, 08/15/2014 - 11:33
div class=field field-type-filefield field-field-blogimage div class=field-items div class=field-item odd img src= alt=teaser image for blog post title=Celebrating 10 years class=imagecache imagecache-blogfull imagecache-default imagecache-blogfull_default width=435 height=336 / /div /div /div pWe are 10 today (ok emstrictly/em tomorrow but it#39;s the weekend!) nbsp;We#39;re all off to Centre Parcs over the bank holiday weekend to celebrate, and thought it was good time to reflect on some of the highlights and changes over the previous ten years./ppa href= target=_blankread more/a/p

Drupal 8 and iOS: GSoC 2014 : An example iOS app project status

Fri, 08/15/2014 - 07:56
span class=field field-node--title field-name-title field-type-string field-label-hidden data-quickedit-field-id=node/67/title/en/rssGSoC 2014 : An example iOS app project status/span div class=field field-node--body field-name-body field-type-text-with-summary field-label-hidden data-quickedit-field-id=node/67/body/en/rss div class=field-items div class=field-item property=schema:textpspanHello Drupal Community,/span/p pspanI and my mentor Jeff Linwood ( a href= ) we are very glad to inform you that GSoC 2014 project - an example iOS application for Drupal 8 has been completed.Links to all these projects along with demo video is given below. /span/p p /p pspanDrupalRESTKit : a href= pspanTipsamp;Tricks AFNetworking : a href= pspanTipsamp;Tricks NSURLSessionAPI : a href= pspanDemo :a href= p /p pspanAs per the requirement we have demonstrated CRUD operation for content entity , login - logout , fetching data from REST export ( for view). Due to file related bug in REST module () we are unable to demonstrate CRUD on file resources. We have used AFNetworking and we have also created same project with NSURLSession API./span/p p /p pspan We have also created a generic DrupalRESTKit it simplifies developers task for CRUD on content entity, user, and comments. And still we are improving it. Any suggestion and feature requests are welcomed. If  you are an iOS developer then you can participate too. /span/p p /p pspanWe have several other ideas in mind like we want to create an iOS app that can control Drupal 8 settings and configuration like putting site on maintenance mode, approving comments , user etc./span/p pspanIs you face any problem regarding iOS and Drupal 8 communication ( specially REST module ) I would like to help you please mail me at a If you find my project useful please intimate me. /span/p p /p/div /div /div div class=field field-node--field-tags field-name-field-tags field-type-taxonomy-term-reference field-label-above clearfix data-quickedit-field-id=node/67/field_tags/en/rss h3 class=field-labelTags: /h3 ul class=links li class=taxonomy-term-reference-0a href=/taxonomy/term/3 property=schema:aboutDrupal Planet/a/li /ul /div div class=field field-node--comment field-name-comment field-type-comment field-label-hidden data-quickedit-field-id=node/67/comment/en/rss div class=field-items div class=field-item rel=schema:commentsection id=comments class=comment-wrapper /section /div /div /div

Metal Toad: Drupal 7 Form API: Using #states with multiple conditionals (AND, OR and XOR)

Thu, 08/14/2014 - 20:53
pI've been playing with D7 forms lately and have found #states to be somewhat challenging due to lack of documentation on a href=!topics!forms_api_reference.html/7#statesForm API page/ / I've poked around a bit and decided to write a blog with my findings in case someone else is in need of this info down the / If you are looking for a robust solution for conditional fields, I would suggest looking into a href= fields/a./pul class=links inlineli class=0 first lasta href= rel=tag title=Drupal 7 Form API: Using #states with multiple conditionals (AND, OR and XOR)Read more/a/li /ul

Dries Buytaert: refresh launched

Thu, 08/14/2014 - 19:52
div class=field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-abovediv class=field-labelTopic:nbsp;/divdiv class=field-itemsdiv class=field-item evena href=/tag/drupal typeof=skos:Concept property=rdfs:label skos:prefLabel datatype=Drupal/a/div/div/divdiv class=field field-name-body field-type-text-with-summary field-label-hiddendiv class=field-itemsdiv class=field-item even property=content:encodedpBack in the early days of Drupal, a href= looked like this:/p div class=figure img src= in 2005 style=border: 1px solid #ccc; padding: 4px;/ as launched in 2005./p /div pOn August 14 2009, I relaunched a href= to replace the oh-so-embarrassing placeholder page. The 2009 re-launch turned a href= into a better spotlight for Drupal. It wasn't hard to beat the white page with a Druplicon logo./p div class=figure img src= in 2009 style=border: 1px solid #ccc; padding: 4px;/ as launched in 2009./p /div pWhat was a good spotlight five years ago though is no longer a good spotlight today. Five years later, a href= didn't do Drupal justice. It didn't really explain what Drupal is, what you can use Drupal for, and more. Along with sub-optimal content, the site wasn't optimized for mobile use either./p pToday, exactly five years later to the day, I'm excited to announce that I relaunched a href= again:/p div class=figure img src= alt=Drupal com devices style=border: 1px solid #ccc; padding: 4px;/ /div pRedesigning a href= to make it more useful and current has been one of my New Year's resolutions for a number of years now. And as of today, I can finally strike that off my list./p pThe new a href= has become richer in its content; you'll find a bit more information about Drupal to help people understand what Drupal is all about and how to get started with Drupal. On a desktop, on a tablet, on a phone, the site has become much easier to navigate and read./p pI believe the new a href= is a much better, more relevant showcase for Drupal. The goal is to update the site more regularly and to keep adding to it. My next step is to add more use cases and to include short demo videos of both the Drupal backend as well as the showcases. a href= will become an increasingly helpful resource and starting point for people who are evaluating Drupal./p div class=figure img src= alt=Drupal com mobile style=border: 1px solid #ccc; padding: 4px;/ /div pThe changes are not limited to content and look; a href= also has a new engine as the site was upgraded from Drupal 6 to Drupal 8 alpha (don't try this at home). We're using Drupal 8 to push the boundaries of site building and responsive design and to uncover bugs and usability issues with Drupal 8. Because we're using an alpha version of Drupal 8, things might not function perfectly yet. We’d still love to hear feedback from designers and front end developers on how it’s working./p/div/div/div

Aten Design Group: Making Sense of Drupal Views Relationships and Entity References

Thu, 08/14/2014 - 17:43
pemIf you're not already familiar with the subject, check out a href= Steidl/a's intro to a href= References/a/em./p pDrupal has some powerful tools for creating and managing complex content relationships. Views relationships using Entity References across more than one content type can be used to establish multi-tiered content relationships. The results can be great, but setting up Entity References across content types with Views can be... well, complicated./p pWe recently added new functionality to a client’s site that involved Entity References to group content and display it dynamically. The project included a sidebar of links to all the related content that spanned three content types. This wasn’t really possible as a menu block because the links needed to contain some of the actual content. I also considered doing all of this in code but that could mean running a number of extra database queries on every page load. With Views, all of that can be easily cached./p pWhen it comes to relationships in Views, creating a relationship from one content type to another, the number of permutations is usually small enough that it only takes a few minutes to try all of them until you get the desired output. When you try to relate content to content to content, the permutations of configuration options in Views gets a little unwieldy. And, I create and/or modify Views with complicated relationships so infrequently that I never remember how to do it. Trying to debug the query built by Views looks even scarier. !--break-- a href= Dewey/a was able to assist me, and we got relationships working even when needing to chain five different nodes together through their reference fields./p pHere’s one portion of the sidebar:br /br / img src=/sites/default/files/Should_the_Media_Actively_Support_Transitional_Justice_Efforts____International_Center_for_Transitional_Justice.pngbr //p pRather than go through the specific case with our client, I’ve setup a very general one./p pContent Type A has an entity reference field to Content Type B. Content Type B has an entity reference field to Content Type C:br /br / img src=/sites/default/files/content_type_overview.jpgbr //p pHere’s how that content /br / img src=/sites/default/files/node_example.jpg/br //p pWhen trying to set this up in views, relationship descriptions for entity reference fields don’t help. Is it emA bridge to the Content entity that is referencing Content via field_other_content/em or is it emA bridge to the Content entity that is referenced via field_content/em?/p pemA bridge to the Content entity that is referenced via field_content/em means your entity is referenced by another via an entity reference field. emA bridge to the Content entity that is referencing Content via field_other_content/em means your entity has the reference field. This will become more clear as we go through our example./p pLet’s say we’re on the page for node 4, of Content Type C, and on this page we want to list all the related nodes that are of Content Type C. To do that, you need the B node referencing your C node. Then the A node referencing the B node. Next all the B nodes referenced by the A node. Finally, all C nodes referenced by the B nodes. Phew!/p pTo do this with Views, we start with a contextual filter of the current /br / img src=/sites/default/files/contextual%20filter.pngbr //p pNext we setup the layers of relationships. First from that C node to the B node. Thus we’re using an entity reference relationship called emA bridge to the Content entity that is referencing Content via field_c./em Each B node has an entity reference field to its C nodes. To make things easier to read we’re setting the Identifier and the Administrative /br / img src=/sites/default/files/The%20B%20node%20relationship.pngbr //p pTo get the A node we need another relationship for the entity reference field in A nodes I’ve named field_b. emA bridge to the Content entity that is referencing Content via field_b./em Again, the content this relationship gives you is doing the referencing. And we’re connecting it to the previous /br / img src=/sites/default/files/The%20A%20node%20relationship.pngbr //p pNow we want to go back down the chain and get all B nodes. So, now we’ve got content that is referenced. So, we use emA bridge to the Content entity that is referenced via field_b./em Again, include the previous /br / img src=/sites/default/files/all%20b%20nodes%20relationship.pngbr //p pTo get all C nodes it’s done the same /br / img src=/sites/default/files/all%20c%20nodes%20relationship.pngbr //p pFinally, to output the titles of all those C nodes, we use the correct relationship for that field. For this Views preview we use the nid of C 4, and get the following output of node titles:br /br / img src=/sites/default/files/relationship_test_result_1.pngbr //p pYou’ll want to turn on caching for the database queries and if possible, for the rendered HTML in query settings./p pSee, that wasn’t so hard, was it?/p We love BoF at DrupalCon Amsterdam

Thu, 08/14/2014 - 17:42
pThere is a href= huge amount of exciting things/a happening around Drupal multilingual at DrupalCon Amsterdam. This time we'll have a meetup of all the people who love The site seriously needs people who care about it enough to devote time to maintaining and fixing bugs. I set up this BoF to gather people interesting in the well-being of the site titled a href= love We need to upgrade to Drupal 7, support the whole range of new Drupal 8 APIs, drastically improve performance and then get new features going. See you there!/p pa href= target=_blankread more/a/p

Drupal Association News: NERD Summit: Building Diversity in New England's Open Source Community

Thu, 08/14/2014 - 16:45
div class=field field-name-body field-type-text-with-summary field-label-hiddendiv class=field-itemsdiv class=field-item evenpimg alt=NERD logo class=left src= style=width: 245px; height: 97px; /Sometime last year, a local Drupalist named a href= Albrecht/a reached out to me. He had this idea that came out of his own personal experiences, and was further inspired by a href= Camp/a and a href= Mars/a (Forest, of course, coined the acronym NERDS). The a href= NERD (New England Regional Developers) Summit /awill be held at the University of Massachusetts Amherst, September 12-14, 2014. Its seed was, in part, the Western Mass Drupal Camp. But in the interests of making Drupal better, NERDS has a bigger mission and a bigger tent./p pIn starting NERDS, Kelly’s “a-ha!” moment came when he was having trouble finding good developers to hire at a href= Call Media/a. He found an amazing new addition to his development team, but she had to be urged to apply for the job because she assumed she wasn’t good enough. Now she’s one of his best developers. All of this caused him to wonder: How many more closeted tech geeks, who are usually marginalized in our industry for various reasons, could be encouraged to learn the skills they need to be great web professionals?/p pKelly was also thinking about all the other things going on right now in Drupal, and in other open source communities. We all know the incredibly important post by a href= Garfield, Getting off the island/a. Drupal is working hard to cross-pollinate with other open source technologies. I like to call that “tech diversity”. We also know that a href= Drupal community is working hard to increase human diversity in its community as well/a. And there is increasing awareness that a href= in open source, and in tech in general, will help make our technologies, our companies, and our working lives better/a./p pAs the NERDS steering committee came together to start talking, a clear vision started to form. What if we put a huge effort into making a richer, more diverse talent pool in New England? What if we put on a free, welcoming, friendly, annual conference, where people could come together to learn with and from peers?  Would that start to shift things for the better? What if we also brought Drupal, Wordpress, general web development, UX strategists, Rubyists, Python coders, hackers, and everyone together for this event, so that we could get off our islands and out of our silos and grow our communities? Would these connections then help spur momentum for ongoing collaborative, informal learning and business networking throughout the rest of the year?/p pSo those are the main ideas behind NERDS. Kelly, myself, and a great bunch of volunteers are working to help make it a reality. Even though we’re new and a little disorganized, we’ve got momentum, passion, and the willingness to experiment and iterate. If being part of this idea appeals to you, please consider a href= a session by 8/15/a, a href= to do planning tasks now or event tasks on the day(s) of the conference/a, or a href= Acquia, Pantheon, and others in sponsoring the conference/a (there are many levels and options, and you can get mad karma points for sponsoring childcare). Tomorrow’s richer, better, more diverse open source communities will thank you./p h2 NERDS in a Nutshell/h2 ulli NERDS is a strongFREE/strong collaborative learning conference. Yes, free. It you want a t-shirt with our awesome logo and meal tickets, you can pay more. But you don’t have to. Either way, a href= you want to attend, you must register to let us know you’re coming/a./li li Friday is a learning day for beginners and for experienced devs who want to level up and try new things (Susan Buck of a href=, keynote); Saturday is the main sessions day (a href= Dreyden/a, keynote); Sunday is sprinting day and a hackathon (a href= McKenna/a, keynote)./li li Have kids? We will have strongchildcare for ages 0-10/strong, and a strongyouth Scratch and maker track/strong. Really./li li NERDS is a brand new, volunteer-run, sponsor-funded experiment. There’s already much momentum and a href= 50 excellent proposed sessions/a. It’s happening, and a href= need sponsors/a, a href= to help before and during the conference/a, and a href=’re still accepting sessions until 8/15 if you’d like to submit something/a./li /ul/div/div/div

Drupal Association News: Join the Next Drupal Association Board Meeting: 20 August

Thu, 08/14/2014 - 16:35
div class=field field-name-body field-type-text-with-summary field-label-hiddendiv class=field-itemsdiv class=field-item evenpimg alt= src= style=width: 240px; height: 160px; border-width: 0px; border-style: solid; margin: 10px; float: left; /Our a href= board meeting is scheduled for 20 August, 2014/a and in addition to our regular updates we will have a couple of great topics to discuss: DrupalCon Austin Recap and Licensing issues on /p pOur DrupalCon Austin Recap will cover all the results of the Con, from the logistics to the sessions, to the marketing, to the finances. There is a lot of great news to report, along with some really great questions that we are going to have to answer to continue to improve the conference./p pLicensing on has been an issue for a very long time now. With so much contributed content, so few volunteers in this area, and with little guidance, the policies we do have in place have been applied inconsistently and some issues that have been reported have never really been addressed. I pulled together a group of folks who have been working on licensing over the years and they developed a proposal for the board's consideration about how to best move forward to provide clear, consistent, and timely action for licensing issues. /p pAll of a href= materials for the board meeting/a can be found online, and we hope you'll a href= us on 20 August/a!/p pemFlickr photo: a href= Pol/a/em/p /div/div/div

Forum One: Running Drupal on HHVM

Thu, 08/14/2014 - 16:14
pimg class=alignright wp-image-3920 size-medium style=float: right; src= alt=Drupal on HHVM width=221 height=300 /Last March, Facebook a href= target=_blankannounced HACK/a, a new open source programming language for its HipHop Virtual Machine (HHVM) touted to interoperate seamlessly with PHP. Following the announcement, I was fascinated watching everything they attempted with the new release in trying to wring as much performance as possible from PHP. This gave me an idea: Although we don#8217;t face the exact challenges that Facebook does on a daily basis, it would be interesting to see what would happen if I tried running Drupal under HHVM, the latest iteration of Facebook#8217;s execution engine./p pOfficial HHVM packages are only distributed for Ubuntu and Debian, but thankfully some enterprising people have packaged them up for CentOS. So with a quick stand up of a Virtual Machine and some additional packages, we were good to go. To test, we chose a fairly complex site that we developed last year, built on the usual Panels and Display Suite with significant relationships between the content. This meant that on any given page, Drupal was likely to load and render several entities beyond just the one on the page./p pI took the current PHP and database for the site and stood it up on a local VM with 4 cores and 6.5 GB of memory. We did some minor optimization of FPM to set the number of servers, along with some increases to the caches in MySQL. Other than that, it’s pretty much a vanilla installation of PHP 5.3 with XCache, Percona 5.5, and nginx. The goal was to provide as much of an “apples to apples” comparison of the two interpreters without as much regard for making everything as fast possible. We then spidered the site and sampled out 1000 URLs at random and ran JMeter to generate 30 concurrent requests against the site running with HHVM and PHP-FPM. We recorded time and load on the server./p h2bPHP-FPM/b/h2 pStarting off, we ran the test against a cold start of the site. We cleared the Drupal cache and restarted nginx, PHP-FPM and MySQL. We then hit the home page with a single request to build the persistently cached items. As the requests started ramping up, the time to complete each one went up as expected./p div id=attachment_3391 style=width: 710px class=wp-caption aligncentera class=image-link href= class=wp-image-3391 size-large src= alt=Average response time sampled every 5 seconds, cold start width=700 height=361 //ap class=wp-caption-textAverage response time sampled every 5 seconds, cold start/p/div pWhat was happening on the server mirrors that./p div id=attachment_3392 style=width: 710px class=wp-caption aligncentera class=image-link href= class=wp-image-3392 size-large src= alt=Overall CPU and memory usage, cold start width=700 height=259 //ap class=wp-caption-textOverall CPU and memory usage, cold start/p/div pWe checked the actual processes that were generating the CPU and memory usage, in this case only pulling out mysqld since tracking each process from PHP-FHM was challenging./p div id=attachment_3393 style=width: 710px class=wp-caption aligncentera class=image-link href= class=wp-image-3393 size-large src= alt=CPU usage for mysqld, cold start width=700 height=259 //ap class=wp-caption-textCPU usage for mysqld, cold start/p/div div id=attachment_3394 style=width: 710px class=wp-caption aligncentera class=image-link href= class=wp-image-3394 size-large src= alt=Memory usage for mysqld, cold start width=700 height=258 //ap class=wp-caption-textMemory usage for mysqld, cold start/p/div pMySQL was using anywhere from 40 span style=color: #545454;–/span 60%, with a few spikes to just over 100% of one core. All the other cores were entirely used by PHP-FPM. Similarly, MySQL was using, on average, about 300 MB of memory. I#8217;m not entirely sure what was causing the areas where processing pauses and response times spike. I saw them on all scenarios, and my guess is that they were due to some sort of I/O blocking, maybe from MySQL or nginx./p pAs a second test, we ran the exact same URLs against the system, clearing the Drupal cache to see if a burn in iteration for XCache and MySQL would help. Overall, it reduced the median response time by a whole 400 milliseconds and increased the throughput by a whopping 2.081 pages per minute. The response times in general were a little more choppy with fewer of the peaks and valleys from the previous run, but the results were pretty consistent./p div id=attachment_3395 style=width: 710px class=wp-caption aligncentera class=image-link href= class=wp-image-3395 size-large src= alt=Average response time sampled every 5 seconds, warm start width=700 height=361 //ap class=wp-caption-textAverage response time sampled every 5 seconds, warm start/p/div div id=attachment_3396 style=width: 710px class=wp-caption aligncentera class=image-link href= class=wp-image-3396 size-large src= alt=Overall CPU and memory usage, warm start width=700 height=259 //ap class=wp-caption-textOverall CPU and memory usage, warm start/p/div h2HHVM/h2 pAfter that we restarted the machine, switching out PHP-FPM for HHVM. Thankfully, it supports fastCGI, so it was a simple matter of altering the nginx configuration slightly. The setup was the exact same as for PHP-FPM; we made sure that the Drupal cache was cleared and restarted MySQL and nginx. We then hit the homepage with a single request and started up JMeter./p div id=attachment_3397 style=width: 710px class=wp-caption aligncentera class=image-link href= class=wp-image-3397 size-large src= alt=Average response time sampled every 5 seconds, cold start width=700 height=361 //ap class=wp-caption-textAverage response time sampled every 5 seconds, cold start/p/div pThe first thing we noticed was that it completed in just under half the time, 6:28 as opposed to 13:21. Every part of the response graph was better, and both the peaks and valleys were significantly lower. The little hiccup at the very start before it dropped, was the JIT compiler running./p pLooking at the server stats, those were improved as well./p div id=attachment_3398 style=width: 710px class=wp-caption aligncentera class=image-link href= class=wp-image-3398 size-large src= alt=Overall CPU and memory usage, cold start width=700 height=259 //ap class=wp-caption-textOverall CPU and memory usage, cold start/p/div pHHVM runs as a single process, so we were able to capture CPU and memory usage separately for them./p div id=attachment_3399 style=width: 710px class=wp-caption aligncentera class=image-link href= class=wp-image-3399 size-large src= alt=CPU usage for mysqld and hhvm, cold start width=700 height=260 //ap class=wp-caption-textCPU usage for mysqld and hhvm, cold start/p/div div id=attachment_3400 style=width: 710px class=wp-caption aligncentera class=image-link href= class=wp-image-3400 size-large src= alt=Memory usage for mysqld and hhvm, cold start width=700 height=260 //ap class=wp-caption-textMemory usage for mysqld and hhvm, cold start/p/div pJust looking at these graphs, it’s pretty easy to tell a couple of things. Namely, both CPU and memory usage for HHVM are improved over PHP-FPM. Peak memory usage for HHVM was just about 320 MB for a total system usage of approximately 20% compared to the 25 span style=color: #545454;–/span 26% under PHP-FPM. Likewise, total CPU usage was lower with only a couple of spikes to over 90% and the median closer to 60%, compared to consistent spike to 95% CPU and a median closer to 70 span style=color: #545454;–/span 75%./p pSimilar to the PHP-FPM test, we also ran the scenario against a warm start of HHVM. Like PHP-FPM, there was very little difference, only about a 200 millisecond difference in median response time./p h2bAnalysis/b/h2 pIf we are to look at the high level, HHVM compares very well to PHP-FPM./p pa class=image-link href= class=aligncenter wp-image-3401 size-full src= alt=hhvm-11 width=600 height=371 //a/p pa class=image-link href= class=aligncenter wp-image-3402 size-full src= alt=hhvm-12 width=600 height=371 //a/p pWe saw more than double the throughput and less than half the average response time. Combined with the decrease in system resources needed, it’s a pretty compelling argument to switch to HHVM./p pThere are some important considerations, however. The biggest is that while the HHVM team is attempting to get as close to Zend PHP as possible, they aren’t there yet. As of the latest reports, HHVM passes 99.83% of the unit tests for Drupal, but there’s no idea how whatever idiosyncrasies exist in various contributed modules will affect it. For instance, we couldn’t get GD to work at all, despite all indications that it should. Thankfully, it’s easily replaceable with ImageMagick span style=color: #252525;–/span for most manipulations. In fact, we didn’t run into any pages during our test that failed with HHVM, but you never know what might not work until you actually run into it. In addition, the testing was done entirely on the front end. While we went through a couple of common scenarios on the administrative side, we didn’t test that thoroughly. Some PHP modules have been ported, such as APC and memcache, and there is work by third parties to add others, such as MongoDB, Ice and Redis, but many modules haven’t and probably will never be./p pIt’s also a moving target. Right now the HHVM team is looking at around an 8-week release cycle. Presumably there won’t be significant regressions as they move forward, but you never know. Similarly, they are targeting Ubuntu and Debian for official packages, so if you’re running Fedora or CentOS you have to either build from source or depend on a third party repository that may not be up to date./p h2Disclaimers/h2 pThe performance results shown above are from running a production site on a very much #8216;non-production#8217; virtual machine running on MacBook Pro with a 2.3 GHz Core i7 processor. There was very little tuning on any portion of the stack to ensure best performance. Load testing was performed from a separate machine over a wireless network, albeit one that was not being used for any other purpose. The load testing did not include any wait time or requests for non-PHP assets and was not intended to simulate real usage, merely to benchmark the performance of the PHP interpreters./p pnbsp;/p

Gábor Hojtsy: All the multilingual happenings at DrupalCon Amsterdam

Thu, 08/14/2014 - 15:51
div class=field field-name-body field-type-text-with-summary field-label-hidden view-mode-rssdiv class=field-itemsdiv class=field-item evenpa href= Amsterdam/a is coming up in just a few weeks and it is full of opportunities to learn about and get all your questions answered when it comes to multilingual Drupal. What's better, you can get involved making things happen and learn from those implementing the features firsthand. Here are my picks:/p h3Multilingual Drupal 8 site building and programming/h3 pimg src= align=right style=margin: 0 0 2em 2em; //p ulliThere is no excuse to not a href= some of the sprints/a at and around DrupalCon. Sprints start two days ahead of the start of the conference on Saturday the week before. And there are still sprints going on the Sunday after the conference. It is not just the last day of DrupalCon itself where you can get involved and make a difference. In fact the leads are actually focusing more on the sprint on the weekend days. Also the weekend sprints are in a emreally cool/em venue. The best way to learn is to do!/li liYou are looking for more of a directed guide of Drupal 8 still with the possibility to do it all hands-on? Look no further than a href= Drupal 8 multilingual hands-on lab/a presented by Aimee Degnan of Hook42 and myself from Acquia. The schedule info is a bit misleading, this session spans two timeslots and lasts two hours. Bring your laptop with Drupal 8 freshly installed!/li liDive deeper into the APIs of Drupal 8! Francesco Placella from Tag1 presents a href= Content in D8: a Highly Evolved Permutated API/a showing how to code with the new system. While not strictly multilingual, in a href= API is dead. Long live Entity Field API!/a swentel, yched and amateescu show how the most essential content element storage system changed and this is full of multilingual support of course./li /ulh3Multilingual Drupal 7 site building and programming/h3 ullia href= Site Setup and Management/a is a half hour session from Robert Vandenberg and Rob Bailey of Lingotek back to back with a href= a multilingual amp; multi-country e-commerce site for luxury brands/a another half hour talk from Arthur Murauskas of Adyax with real life examples./li liDagmar Muth and Urs Bucher from Amazee Labs are presenting a href= a Multilingual, Multidomain Drupal Site/a synthesizing their experience from multiple customers./li liI proposed the a href= therapy (questions and answers)/a BoF again! Waiting experienced folks as well as everyone with questions. You'll see even if you arrive with several questions, you can answer others! There is no set agenda, just to answer all the questions!/li /ulh3Moving forward/h3 pThe site seriously needs people who care about it enough to devote time to maintaining and fixing bugs. I set up one more BoF to gather people interesting in the well-being of this site titled a href= love We need to upgrade to Drupal 7, support the whole range of new Drupal 8 APIs, drastically improve performance and then get new features going./p hr /pThese are all the multilingual pieces that I collected. There may still be more, BoF scheduling just started and I may have missed a session or two. Let us know in the comments what other great events happen around multilingual Drupal. See you in Amsterdam!/p /div/div/div

Drupal @ Penn State: Delicious Drush desserts

Thu, 08/14/2014 - 14:03
div class=field field-name-body field-type-text-with-summary field-label-hiddendiv class=field-itemsdiv class=field-item even property=content:encodedpI'm incredibly lazy, motivated, but lazy; and I hope you are too. This drives all of us to try and automate everything in life and makes Drupal developers look like rock stars of productivity while lounging in sleep pants with their morning coffee. What am I talking about? Drush, and specifically a new form of chain automation with drush that I'm going to be show-casing today. This is something I've been raving about the sandbox / dev build of on twitter for awhile now./p/div/div/div