Craft CMS Summit 2014
The Craft CMS Summit 2014 happened on June 17 and was organized by Christopher Schmitt from Environments for Humans. The $99 ticket felt like a good deal. I found it worthwhile because I left with more practical ideas than I usually get from conferences.
State of Craft CMS
Brandon Kelly, the founder of Pixel & Tonic, started by sharing how Craft began. The idea first came together in 2010, with custom fields and live preview as planned features from the beginning. In 2011, after a market analysis, they decided to build a CMS that could handle any kind of content. The project was called Blocks at first, and the goal was for every entry to have its own content structure.
The talk stood out because Kelly showed screenshots of the Pixel & Tonic team's Basecamp messages from the development period. Seeing those internal conversations was one of the highlights. He also walked through the ten different control panel designs Craft went through before landing on the current one.
The timeline:
- Early 2012: Private alpha, decision to use Twig instead of building a custom template engine
- November 2012: Private beta
- March 2013: Public beta and renamed to Craft
- June 2013: Release
Kelly also shared some numbers:
- Over 100 updates since the public beta
- 6 major releases
- 82% of active control panels running Craft 2
- 40% already on Craft 2.1
- 13,600 registered licenses
- 3,300 active sites in the last 30 days
Revenue at Pixel & Tonic has exploded since the Craft 2 launch.
Kelly also announced better documentation and an official plugin store that will be built right into the control panel. We got a quick preview of Craft 3.0, but there weren't many details yet.
Twig for Designers
Ben Parizek from Barrel Strength Design gave an introduction to Twig. The section on functions, filters, and DRY principles was an eye-opener. I had barely scratched the surface of what Twig can do.
Custom Matrix with Craft
Anthony Colangelo from Happy Cog explained why Craft's Matrix is a real game-changer for content management. Building on Ben's session, he showed how to use Twig's template inheritance and manage Matrix blocks well. You can set up default templates for Matrix blocks and override them with specific ones when certain conditions are met, like a particular section or custom field value.
This talk made the biggest impression on me. I know I'll be reviewing the slides several times.
Real World Craft Tips & Tricks
Trevor Davis from Viget shared practical tips for everyday development. He talked about using environment variables for different development setups and explained why Craft's {% switch %} tag is better than using if/else chains.
One helpful example was how to alternate CSS classes for odd and even entries using Twig's cycle function:
{% for entry in craft.entries({ section: 'news' }) %}
<article class="news--{{ cycle(['odd', 'even'], loop.index0) }}">
<h2>{{ entry.title }}</h2>
{{ entry.summary }}
</article>
{% endfor %}
He also gave a more advanced example using the merge filter for dynamic query parameters:
{% set filters = ['type', 'product', 'activity', 'element'] %}
{% set params = { section: 'media', limit: 12 } %}
{# Apply filter? #}
{% if craft.request.segments[2] is defined and craft.request.segments[1] in filters %}
{% switch craft.request.segments[1] %}
{% case 'product' %}
{% set product = craft.entries({ slug: craft.request.segments[2], section: 'product' }).first() %}
{% set params = params | merge({ relatedTo: product }) %}
{% case 'type' %}
{% set params = params | merge({ type: craft.request.segments[2] }) %}
...
{% endswitch %}
{% endif %}
{% set entries = craft.entries(params) %}
Other topics included macros, caching for different environments, and more tips for working with Matrix.
Element Types and Plugin Development
Ben Croker from PutYourLightsOn talked about Craft's architecture, including the Yii framework and the MVC model, and how these fit together in Craft. He mainly focused on developing plugins with Element Types and showed an example plugin:
<?php
namespace Craft;
class Commerce_ProductElementType extends BaseEelementType
{
public function getName()
{
return 'Products';
}
public function hasContent()
{
return true;
}
public function hasTitles()
{
return true;
}
public function getSources()
{
$sources = array(
'*' => array(
'label' => Craft::t('All Products'),
)
);
return $sources;
}
}
Craft Q&A / Round Table
Some of the most interesting answers from the closing discussion:
- Pixel & Tonic is developing a strong approach to database synchronization
- A JSON file for fields and sections is on the to-do list
- Matrix within a Matrix is possible in theory, but the UI would be difficult to get right
- "Localization" may be renamed to "Sites" to support running multiple Craft sites from a single installation
- Comments won't be part of core – that's a job for plugins
- Craft 2.2 will get the ability to duplicate entries
- The field layout page will be made more user-friendly
My take
The history section alone was worth the ticket price. Anthony Colangelo's Matrix talk showed me approaches I hadn't considered before. Events like this don't come around often.