Drupal as a Programmer-Friendly CMS at ConFoo

Post on 07-Dec-2014

2.280 views 0 download

description

Drupal is a content management system and a web development platform. With a small set of core modules and a large ecosystem of community contributed modules, it can be used fro a variety of use cases including corporate intranets, social web applications, online publishing, and education or government websites. In this talk, we’ll cover the benefits of using Drupal for developers, and how to use and extend Drupal as a web development framework.Besides being open source and having an active development-driven community, Drupal has many architectural advantages. We’ll discuss these benefits including the hook system, separation of theme and module layers, the emphasis on flexible content architecture, the database integration layer, and Drupal’s coding standards. We’ll also introduce some tools to get you started on the right track, improve the performance of your Drupal projects, and avoid mistakes.

Transcript of Drupal as a Programmer-Friendly CMS at ConFoo

Drupal as a Programmer-Friendly

CMSSuzanne Kennedy

Co-founder @evolvingweb

About Me• Drupal consulting,

development, and training

• Help organizations build awesome Drupal sites + apps

• Specialize in multilingual Drupal and Apache Solr

What Can You Build with Drupal?

Build an Engagement Platform

Publish Lots of Content

Multilingual Content

Flexible Content Architecture

Flexible Theme Layer

Fancy Search UI

Intranets

Web Applications

Drupal as a CMS

NodesNodes are basic content building blocks

Content TypesNodes can have different fields + settings

Event Blog Post• Date• Location• Description• Signup List

• Author + Date Published

• Body Text• Comments

Node Settings

Fields

Revisions

Taxonomy

Taxonomy

Vocabulary

Terms

Child Terms

Taxonomy + Fields

Menus

Roles

Permissions

Blocks

Themes

Modules

Specific Modules

API-Style Modules

Voting API Rules

API-Style Modules

Flag API

Custom Modules

Custom > Contrib

Administrative UI

Multilingual

Content Translation UI Translation

Multilingual

Drupal as a Framework

Content Architecture

Entity Type

Bundles

Entities

Entity Types

Taxonomy

city break

CommentsUsers

D. SchruteGermany

J. HalpertSpain

adventure

city break

sailing

shopping

dwight8 Sept

Wow, can't wait to get started.

joe8 Sept

Me too!

Content

Content title

Entity types are classes that define content

Custom Entity Types

You can define custom entity types

Entity API

CRUD for Entities

Editing a NodeEditing a Department Entity

Custom Fields

Custom Form Widgets

Custom Formatters

Views

Lists of Content

Defining Lists

Contextual Filters

External Data Sources

Custom Table Query

Activity Stream ViewCustom Activity Table

Features

Configuration = Messy

Text

Illustration: drupal.org/node/580026

Bundles of Config

Features

Contrib

Core

Features

Components

Exportables• Content Types• Fields• Menus• Taxonomy• Views• Image Styles

• WYSIWYG Profiles• Configuration• Rules• Flags Logic• Roles• Permissions

Configuration > Code

Views ConfigurationViews in Code

Benefits of Features

• Stability of the site• Version control• Better development workflow• Distribute to other sites

OpenPublish

Commons

Conference (COD)

Distributions

How Does Drupal Work?

Serving a Request

The steps that Drupal bootstrap carries out when a page request is called.

Drupal Bootstrap

Drupal Menu SystemHow does Drupal know what to render?

Drupal Hook System

How hooks are implemented

Any module can implement a hook as follows:

function <module_name>_<hook_name>(args) { //possibly alter an argument //possibly return something}

Alter Hooks • Modify data generated in other

modules before it gets rendered• Examples:

• hook_form_alter()• hook_mail_alter()• hook_menu_alter()• hook_menu_link_alter()

Form API - benefits• No more HTML generation! • Data validation• Security checks, caching• Code reuse (custom elements, form

altering)• AJAX

Without it...

• Structured arrays define all settings and attributes

• All standard HTML input elements available

Defining form structure

• Array keys starting with '#' are specific form api attributes

• All others are child form elements

Defining form structure

Required Select Box

Multiselect with default

Submission• Simple '#type' =>

'submit' element

• Submit buttons can have their own submit function, allowing different buttons to do different things in a simple way.

Drupal Theme System

1. Load the Theme 2. Preprocess the HTML 3. Display Templates

Things Developers Like

Drush

Coding Standardshttp://drupal.org/coding-standards

Devel

Services Module

Other Drupal Sites

iPad, iPhone Apps Desktop Applications

Hello!

Hello!

Android Apps

Hello!

Other Things Developers Like

• Database Abstraction• Caching• Unit Testing (Simple Test)• Renderable Arrays• Multisite

Drupal.org for Developers

Projects on Drupal.org

Drupal.org Issue Queue

Git Integration

Security Team

Documentation

More Reasons to Use Drupal

Drupal is in Demand!

Drupal is Open Source!

Drupal Community

We’re HiringDevelopersSysadminsProject Managers

evolvingweb.ca/careers

Drupal TrainingDrupal for DevelopersMarch 30th

Drupal Layout & ThemingMay 24-25th

evolvingweb.ca/training

Thank You!Suzanne Kennedy

@evolvingweb