44
One Content Type to Rule Them All Case study of “Any Page” single-content type implementation

DrupalCamp Florida 2015 - One Content Type to Rule Them All

Embed Size (px)

Citation preview

Page 1: DrupalCamp Florida 2015 - One Content Type to Rule Them All

One Content Type

to Rule Them AllCase study of “Any Page” single-content

type implementation

Page 2: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Presenters

Will Jackson● Senior Developer

● Resident Commerce

Consultant

● System Administrator

● Module Maintainer

Anne Easterling● Front-end dev and site

builder

● “Configuration Queen”

● UX/IA consultant

● Most important role:

Advocate for end-user

and editors

Page 3: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Introductions

● Why single-content

type?

● Our model: Any Page

● ECK and other

construction tips

● Demo

● Next steps

● Who are you?

● Site building

experience?

● Other: back-end,

themers?

● Why are you here?

● Most content types

on a site?

Page 4: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Why single-content type?

Page 5: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Problem 1: Content type overload

● Advantage of Drupal: Add as many content

types and fields as needed

● Disadvantage of Drupal: Add as many

content types and fields as you think you

need

● And content types are rigid!

Page 6: DrupalCamp Florida 2015 - One Content Type to Rule Them All

How many content types are too many?

Page 7: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Traditional Content Models

● Focus on “content types.”

● Assume that unique content type is needed

for each page variation.

● Still connect presentation to architecture.(References:

http://pointnorth.io/#content-modeling

http://alistapart.com/article/content-modelling-a-master-skill)

Page 8: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Source: Content Modelling: A Master Skill, A List Apart

Page 9: DrupalCamp Florida 2015 - One Content Type to Rule Them All

● Single-page and long-form pages.

● Mix of visuals: images, videos, graphics.

● Editors want to control order of elements.

● Mix of default and custom sidebar blocks.

Problem 2: Design trends

Page 10: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Single-content type solution:

Any Page

Page 11: DrupalCamp Florida 2015 - One Content Type to Rule Them All

● Rather than content types, IA focuses on

content organization.

● Complex pages (such as landing pages) can

be controlled by editors.

● Easier flexibility for non-content regions,

such as sidebars.

Single-content type solutions

Page 12: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Single content type: Any Page

Content model

Content type

Fields

Custom Theming

⇒ Site structure

⇒ Page type tags

⇒ Reusable blocks

⇒ Built-in style options

Page 13: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Example: Events

Content type:

● Title

● Date

● Location● Description

● Type of event

● Registration form

● Photo, gallery, video

● Speakers● Handouts

Single content type:

● Title

● Tag: Event, Types

● Blocks:Event, Text, Image,

Video, Person, Doc

Attachments, etc.

Page 14: DrupalCamp Florida 2015 - One Content Type to Rule Them All

STRUCTURE

Entity Construction Kit

Entity Reference

Inline Entity Form

Context, Features

Views, View Field

Media

Automatic Entity Label

Any Page: Module magic

UX ENHANCEMENTS/PRESENTATION

Field Group

Multiple Selects

Display Suite / Extras

Fields Conditional

Field Formatter Settings

Field Formatter Conditions

Page 15: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Entity Construction Kit

● Create/Manage entities and bundles from UI.

● Manage properties and custom behaviors.

● Create bundles to share entity configuration.

● Thousands of compatible modules (Field UI).

Page 16: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Entity Construction Kit

Page 17: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Entity Construction Kit

Page 18: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Entity Construction Kit

Page 19: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Alternative tagging: Options entity

● “Options” entity type with two bundles

● Option Type: parent, such as Page Type

● Option: child, such as Event, Blog, Product,

News, etc.

● Also used for supporting options in the Any

Blocks: Layout Options, Link Style, Image

Style, Color Scheme, etc.

Page 20: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Option fields

● Label: human-friendly description

● Machine name:o CSS-friendly string

o Applied as classes to streamline theming

o Related to Bootstrap classes or variables

● Example - Block Color Scheme:

o Label: Purple background / white text

o Machine name: color_brand_contrast_white

Page 21: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Option Types in use on Text Block style options

Page 22: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Any Page node fields

● Title

● Tags: Page type,

categories

● Teaser and teaser

image

● Entity reference fields:

o Main content

o Left sidebar

o Right sidebar

o Content top

o Content bottom

● Default globals

Page 23: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Page Type tag is

alternative to separate

content types. Can be

changed as node usage

changes.

Other functional or

presentation tagging

can be added as

needed.

Page 24: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Recommend using Teaser because

there is no standard Body field to

use as a fallback.

Page 25: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Any Block types

● Each type based on functionality.

● Most block types can be used in any field. (AKA page region: main content, sidebar, etc.)

● Limited field reuse.

Page 26: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Any Block types

● Text block

● Accordion block

● Contact block

● Document Attachments

block

● Event block

● Featured Media block

● Form block

● Image (grid / slideshow)

● Link (menu-style)

● Location block

● Product

● System block (blocks

from core and modules)

● Video block

● View / List block (blocks

from Views)

Page 27: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Any Block: Text block

● Administrative Title

● Display Title (with optional link)

● Style Options(alignment, padding, color,

layout)

● Body

● Image

o Options(style, position, link)

o Image(base and hover)

● Links

o Link style(text or button)

o Title (optional link)

o Links

Page 28: DrupalCamp Florida 2015 - One Content Type to Rule Them All

● Created by the Commerce Guys for Commerce Kickstart.

● Create referenced entities inline without leaving the form.

● Integrate with any new or pre-existing entity.

● Streamline content forms

Inline Entity Form

Page 29: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Inline Entity Form

Page 30: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Demonstration

Page 31: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Life cycle of a page

1. Announcement: Text, images

2. Event: Retag. Add Event, Location blocks

3. Report: Retag. Add Video block.

4. Resource: Retag. Add Document

Attachment block.

Page 32: DrupalCamp Florida 2015 - One Content Type to Rule Them All

● Performanceo Complex configurations may be resource intensive.

● Commerceo Additional customization required for contrib displays

● Searcho Contributed Module Limitations

Technical considerations

Page 33: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Any Page 2.0

● Basic Main Content: Text block fields

without being in Entity Block

● Custom Main Content: Convert original

Main Content.

● Tagging: Taxonomy may be better

● Image handling: Implement Field Formatter

Page 34: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Review

● Advantages of a single content typeo Content that evolves to what you need

o Simplify the process for content editors

● Condense Content Typeso Solve the problem of “a content type for everything”

Page 35: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Questions/Giveaway

Are there any questions?

Page 36: DrupalCamp Florida 2015 - One Content Type to Rule Them All

SCREENSHOTS

Page 37: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Two custom entity types

Any Page uses two custom

entity types: Any Block and

Option Type

Page 38: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Related: Item Sets

used in block

Special Purpose

Parent Bundle (no blocks)

Container block

“Workhorse”

Any Block bundles

Any Block: parent bundle

Text Block: multi-purpose

“workhorse” also includes image

and links

Accordion Block: primary field is

multi-field Accordion Item Set.

Multi-Block Wrapper: allows other

blocks to be displayed in one row.

SEO Description: not available as

block; used separately.

Page 39: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Any Block properties

Administrative Title (instead of

Title) for easier labeling

All bundles have separate

Display Title field

Page 40: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Main content field

Create or reuse entities in

this region.

All blocks are displayed in a

vertical stack.

Page 41: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Left sidebar field

Create or reuse entities in

this region.

All blocks are displayed in a

vertical stack.

Option to override default

display settings on Global

sidebar blocks.

Page 42: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Right sidebar field

Create or reuse entities in

this region.

All blocks are displayed in a

vertical stack.

Page 43: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Content top field

Display options for blocks

displayed in Content Top

region.

Create or reuse entities in

this region.

Page 44: DrupalCamp Florida 2015 - One Content Type to Rule Them All

Content bottom field

Display options for blocks

displayed in Content Bottom

region.

Create or reuse entities in

this region.