SlideShare a Scribd company logo
1 of 269
Modern Theming: Beyond
Preprocessing and .tpls

BADCamp
October 22, 2011
Tim Cosgrove
Modern Theming

Tim Cosgrove




                BADCamp, 2011, Tim Cosgrove
Modern Theming

Tim Cosgrove
‣ Engineer and Tech PM




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Tim Cosgrove
‣ Engineer and Tech PM
‣ Treehouse Agency




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Tim Cosgrove
‣ Engineer and Tech PM
‣ Treehouse Agency
‣ Drupal.org member since
  February 2007




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Tim Cosgrove
‣ Engineer and Tech PM
‣ Treehouse Agency
‣ Drupal.org member since
  February 2007
‣ Web Developer since 1998



                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Tim Cosgrove
‣ Engineer and Tech PM
‣ Treehouse Agency
‣ Drupal.org member since
  February 2007
‣ Web Developer since 1998
‣ @timcosgrove


                         BADCamp, 2011, Tim Cosgrove
Modern Theming


Modern Theming




          BADCamp, 2011, Tim Cosgrove
Modern Theming


Themers are Developers




              BADCamp, 2011, Tim Cosgrove
Modern Theming


Themers are Developers




              BADCamp, 2011, Tim Cosgrove
Modern Theming

Themers are Developers




              BADCamp, 2011, Tim Cosgrove
Modern Theming

Themers are Developers
‣ Much of what is display-related
  ends up in modules, not themes.




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

Themers are Developers
‣ Much of what is display-related
  ends up in modules, not themes.
‣ In Drupal, there is a grey area
  between what is theming and what
  is not theming.




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

Themers are Developers
‣ Much of what is display-related
  ends up in modules, not themes.
‣ In Drupal, there is a grey area
  between what is theming and what
  is not theming.
‣ You write PHP. You are a nerd.
  Embrace it!


                        BADCamp, 2011, Tim Cosgrove
Modern Theming

“Modern Theming”?




            BADCamp, 2011, Tim Cosgrove
Modern Theming

   “Modern Theming”?
‣ Use as much of Core as possible




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

   “Modern Theming”?
‣ Use as much of Core as possible
‣ Use module code, write module code




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

   “Modern Theming”?
‣ Use as much of Core as possible
‣ Use module code, write module code
 ‣ Or, learn what can be done so you
   can tell your developers what you
   need




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

   “Modern Theming”?
‣ Use as much of Core as possible
‣ Use module code, write module code
 ‣ Or, learn what can be done so you
   can tell your developers what you
   need
‣ Use newer technologies where
  appropriate

                       BADCamp, 2011, Tim Cosgrove
Modern Theming

    “Modern Theming”?
‣ Use as much of Core as possible
‣ Use module code, write module code
 ‣ Or, learn what can be done so you
   can tell your developers what you
   need
‣ Use newer technologies where
  appropriate
‣ Avoid the pile-up of .tpls
                         BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




DO NOT DO



        BADCamp, 2011, Tim Cosgrove
Modern Theming

In general, try to forget
Drupal 5 and 6.




                  BADCamp, 2011, Tim Cosgrove
Modern Theming

In general, try to forget
Drupal 5 and 6.
‣ Forget dozens of templates.




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

In general, try to forget
Drupal 5 and 6.
‣ Forget dozens of templates.
‣ Forget dozens of preprocess
  functions.




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

In general, try to forget
Drupal 5 and 6.
‣ Forget dozens of templates.
‣ Forget dozens of preprocess
  functions.
‣ Forget base themes.



                         BADCamp, 2011, Tim Cosgrove
Modern Theming

In general, try to forget
Drupal 5 and 6.
‣ Forget dozens of templates.
‣ Forget dozens of preprocess
  functions.
‣ Forget base themes.
‣   (...though, you can still use all that, and it might be
    appropriate.)




                                              BADCamp, 2011, Tim Cosgrove
Modern Theming

Theming Modernly: GRIDS




               BADCamp, 2011, Tim Cosgrove
Modern Theming

Theming Modernly: GRIDS
‣ You should insist on a grid design.




                        BADCamp, 2011, Tim Cosgrove
Modern Theming

Theming Modernly: GRIDS
‣ You should insist on a grid design.
 ‣ The coherent visual layout makes
   finding information easier.




                        BADCamp, 2011, Tim Cosgrove
Modern Theming

Theming Modernly: GRIDS
‣ You should insist on a grid design.
 ‣ The coherent visual layout makes
   finding information easier.
 ‣ It allows for design and editorial
   elements to move around.




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Theming Modernly: GRIDS
‣ You should insist on a grid design.
 ‣ The coherent visual layout makes
   finding information easier.
 ‣ It allows for design and editorial
   elements to move around.
 ‣ It saves you time which saves them
   money.

                         BADCamp, 2011, Tim Cosgrove
screenshot of listing
block example, with
highlights like previous
slide
screenshot of listing
block example, with
highlights like previous
slide
Modern Theming

Why Grids are Helpful




                BADCamp, 2011, Tim Cosgrove
Modern Theming

Why Grids are Helpful
‣ Items of the same number of units
  are interchangeable




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

Why Grids are Helpful
‣ Items of the same number of units
  are interchangeable
‣ With the right image style settings
  and CSS, you can drop things in and
  they will just work




                        BADCamp, 2011, Tim Cosgrove
`
Modern Theming

Repeating elements




               BADCamp, 2011, Tim Cosgrove
Modern Theming

Repeating elements
‣ Look for items that are similar and
  can be reused




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Repeating elements
‣ Look for items that are similar and
  can be reused
‣ Look for inconsistencies; see if they
  can be unified




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Repeating elements
‣ Look for items that are similar and
  can be reused
‣ Look for inconsistencies; see if they
  can be unified
‣ Again, saves time and money




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Different Content,
  Same Display




            BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming


 Same Content,
Different Displays




            BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Core
Modern Theming

Drupal 7 only - why?




             BADCamp, 2011, Tim Cosgrove
Modern Theming

  Drupal 7 only - why?
‣ Released January 5, 2011 - coming
  up on a year




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

  Drupal 7 only - why?
‣ Released January 5, 2011 - coming
  up on a year
‣ Drupal 6 will stopped being
  supported in about 2-3 years




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

  Drupal 7 only - why?
‣ Released January 5, 2011 - coming
  up on a year
‣ Drupal 6 will stopped being
  supported in about 2-3 years
 ‣ No security updates




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

  Drupal 7 only - why?
‣ Released January 5, 2011 - coming
  up on a year
‣ Drupal 6 will stopped being
  supported in about 2-3 years
 ‣ No security updates
‣ Most widely-used contrib modules
  have at least an alpha out now

                         BADCamp, 2011, Tim Cosgrove
Modern Theming




also...




          BADCamp, 2011, Tim Cosgrove
Modern Theming

Drupal 7 is actually good!




                BADCamp, 2011, Tim Cosgrove
Modern Theming

Drupal 7 is actually good!
‣ Theming improvements:




                     BADCamp, 2011, Tim Cosgrove
Modern Theming

Drupal 7 is actually good!
‣ Theming improvements:
 ‣ Fields in core




                     BADCamp, 2011, Tim Cosgrove
Modern Theming

Drupal 7 is actually good!
‣ Theming improvements:
 ‣ Fields in core
 ‣ preprocess() and process()




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

Drupal 7 is actually good!
‣ Theming improvements:
 ‣ Fields in core
 ‣ preprocess() and process()
 ‣ Render array




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

Drupal 7 is actually good!
‣ Theming improvements:
 ‣ Fields in core
 ‣ preprocess() and process()
 ‣ Render array
 ‣ Theme hook suggestions



                       BADCamp, 2011, Tim Cosgrove
Modern Theming

Drupal 7 is actually good!
‣ Theming improvements:
 ‣ Fields in core
 ‣ preprocess() and process()
 ‣ Render array
 ‣ Theme hook suggestions
 ‣ Core theming is usable!

                       BADCamp, 2011, Tim Cosgrove
Modern Theming

Drupal 7 is actually good!
‣ Theming improvements:
 ‣ Fields in core
 ‣ preprocess() and process()
 ‣ Render array
 ‣ Theme hook suggestions
 ‣ Core theming is usable!
   ‣ No, really!
                       BADCamp, 2011, Tim Cosgrove
Modern Theming

Base theme? Nope.




            BADCamp, 2011, Tim Cosgrove
Modern Theming

    Base theme? Nope.
‣ We use core theming as our starting
  point.




                        BADCamp, 2011, Tim Cosgrove
Modern Theming

    Base theme? Nope.
‣ We use core theming as our starting
  point.
 ‣ .info, reset.css, and a grid system.




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

    Base theme? Nope.
‣ We use core theming as our starting
  point.
 ‣ .info, reset.css, and a grid system.
‣ Core templates produce usable
  markup.




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

    Base theme? Nope.
‣ We use core theming as our starting
  point.
 ‣ .info, reset.css, and a grid system.
‣ Core templates produce usable
  markup.
‣ Base themes make assumptions
  about how you want to theme.

                         BADCamp, 2011, Tim Cosgrove
Modern Theming

        Base theme? Nope.
‣ We use core theming as our starting
  point.
    ‣ .info, reset.css, and a grid system.
‣ Core templates produce usable
  markup.
‣ Base themes make assumptions
  about how you want to theme.
‣   ...which is maybe OK.

                             BADCamp, 2011, Tim Cosgrove
Modern Theming




View Modes




        BADCamp, 2011, Tim Cosgrove
Modern Theming

What are View Modes?




               BADCamp, 2011, Tim Cosgrove
Modern Theming

What are View Modes?
‣ View Modes are awesome.




                      BADCamp, 2011, Tim Cosgrove
Modern Theming

What are View Modes?
‣ View Modes are awesome.
‣ Named ways of displaying the same
  entity differently (node, user,
  custom)




                      BADCamp, 2011, Tim Cosgrove
Modern Theming

What are View Modes?
‣ View Modes are awesome.
‣ Named ways of displaying the same
  entity differently (node, user,
  custom)
‣ Allows you to define display settings
  for anything fieldable



                        BADCamp, 2011, Tim Cosgrove
Modern Theming

What are View Modes?
‣ View Modes are awesome.
‣ Named ways of displaying the same
  entity differently (node, user,
  custom)
‣ Allows you to define display settings
  for anything fieldable
‣ You’re already using them

                        BADCamp, 2011, Tim Cosgrove
View Modes
Modern Theming

Built-in View Modes




                BADCamp, 2011, Tim Cosgrove
Modern Theming

Built-in View Modes
‣ Teaser and Default, active by default




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Built-in View Modes
‣ Teaser and Default, active by default
‣ Core also includes view modes for




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Built-in View Modes
‣ Teaser and Default, active by default
‣ Core also includes view modes for
 ‣ “full”




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Built-in View Modes
‣ Teaser and Default, active by default
‣ Core also includes view modes for
 ‣ “full”
 ‣ RSS




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Built-in View Modes
‣ Teaser and Default, active by default
‣ Core also includes view modes for
 ‣ “full”
 ‣ RSS
 ‣ search index



                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Built-in View Modes
‣ Teaser and Default, active by default
‣ Core also includes view modes for
 ‣ “full”
 ‣ RSS
 ‣ search index
 ‣ search results

                         BADCamp, 2011, Tim Cosgrove
Modern Theming
But why stop there?




             BADCamp, 2011, Tim Cosgrove
Modern Theming
    But why stop there?
All of these are potential view modes




                      BADCamp, 2011, Tim Cosgrove
Modern Theming
    But why stop there?
All of these are potential view modes




                      BADCamp, 2011, Tim Cosgrove
Modern Theming
    But why stop there?
All of these are potential view modes




                      BADCamp, 2011, Tim Cosgrove
Modern Theming
    But why stop there?
All of these are potential view modes




                      BADCamp, 2011, Tim Cosgrove
Modern Theming
    But why stop there?
All of these are potential view modes




                      BADCamp, 2011, Tim Cosgrove
Modern Theming
    But why stop there?
All of these are potential view modes




                      BADCamp, 2011, Tim Cosgrove
Modern Theming
    But why stop there?
All of these are potential view modes




                      BADCamp, 2011, Tim Cosgrove
Modern Theming
    But why stop there?
All of these are potential view modes




                      BADCamp, 2011, Tim Cosgrove
Modern Theming

Why is this useful?




                 BADCamp, 2011, Tim Cosgrove
Modern Theming

Why is this useful?
‣ Different node types (or entities) can
  share view mode names.




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Why is this useful?
‣ Different node types (or entities) can
  share view mode names.
 Contributor




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Why is this useful?
‣ Different node types (or entities) can
  share view mode names.
 Contributor     Article




                            BADCamp, 2011, Tim Cosgrove
Modern Theming

Why is this useful?
‣ Different node types (or entities) can
  share view mode names.
 Contributor     Article             Video




                            BADCamp, 2011, Tim Cosgrove
Modern Theming

Why is this useful?
 ‣ Different node types (or entities) can
   share view mode names.
 Contributor      Article             Video




‣ Different field sources, same (or
  similar) display
                             BADCamp, 2011, Tim Cosgrove
Modern Theming

Different contexts




            BADCamp, 2011, Tim Cosgrove
Modern Theming

    Different contexts
‣ View Modes can be used to render
  entities in:




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

    Different contexts
‣ View Modes can be used to render
  entities in:
 ‣ Views




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

    Different contexts
‣ View Modes can be used to render
  entities in:
 ‣ Views
 ‣ Reference fields




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

    Different contexts
‣ View Modes can be used to render
  entities in:
 ‣ Views
 ‣ Reference fields
 ‣ Beans / block entities



                        BADCamp, 2011, Tim Cosgrove
Modern Theming

    Different contexts
‣ View Modes can be used to render
  entities in:
 ‣ Views
 ‣ Reference fields
 ‣ Beans / block entities
 ‣ Any custom callback or block


                        BADCamp, 2011, Tim Cosgrove
Modern Theming




 BADCamp, 2011, Tim Cosgrove
Modern Theming

             View Modes in Code
/**
* Implements hook_entity_info_alter().
*/
function energy_content_entity_info_alter(&$info) {
    $info['node']['view modes'] += array(
     'block_teaser' => array(
         'label' => t('Block teaser'),
         'custom settings' => TRUE,
     ),
    );
}


                                             BADCamp, 2011, Tim Cosgrove
Modern Theming

             View Modes in Code
/**
* Implements hook_entity_info_alter().
*/
function energy_content_entity_info_alter(&$info) {
    $info['node']['view modes'] += array(
     'block_teaser' => array(
         'label' => t('Block teaser'),
         'custom settings' => TRUE,
     ),
    );
}


                                             BADCamp, 2011, Tim Cosgrove
Modern Theming

             View Modes in Code
/**
* Implements hook_entity_info_alter().
*/
function energy_content_entity_info_alter(&$info) {
    $info['node']['view modes'] += array(
     'block_teaser' => array(
         'label' => t('Block teaser'),
         'custom settings' => TRUE,
     ),
    );
}


                                             BADCamp, 2011, Tim Cosgrove
Modern Theming

             View Modes in Code
/**
* Implements hook_entity_info_alter().
*/
function energy_content_entity_info_alter(&$info) {
    $info['node']['view modes'] += array(
     'block_teaser' => array(
         'label' => t('Block teaser'),
         'custom settings' => TRUE,
     ),
    );
}


                                             BADCamp, 2011, Tim Cosgrove
Modern Theming

             View Modes in Code
/**
* Implements hook_entity_info_alter().
*/
function energy_content_entity_info_alter(&$info) {
    $info['node']['view modes'] += array(
     'block_teaser' => array(
         'label' => t('Block teaser'),
         'custom settings' => TRUE,
     ),
    );
}


                                             BADCamp, 2011, Tim Cosgrove
Modern Theming

             View Modes in Code
/**
* Implements hook_entity_info_alter().
*/
function energy_content_entity_info_alter(&$info) {
    $info['node']['view modes'] += array(
     'block_teaser' => array(
         'label' => t('Block teaser'),
         'custom settings' => TRUE,
     ),
    );
}


                                             BADCamp, 2011, Tim Cosgrove
Modern Theming

             View Modes in Code
/**
* Implements hook_entity_info_alter().
*/
function energy_content_entity_info_alter(&$info) {
    $info['node']['view modes'] += array(
     'block_teaser' => array(
         'label' => t('Block teaser'),
         'custom settings' => TRUE,
     ),
    );
}


                                             BADCamp, 2011, Tim Cosgrove
Modern Theming




...or you can use
  Display Suite.
   But we’ll come back to that.




                           BADCamp, 2011, Tim Cosgrove
O HAI
O HAI
Modern Theming
View Modes entity
 settings in code




            BADCamp, 2011, Tim Cosgrove
Modern Theming
    View Modes entity
     settings in code
‣ If you export node or other entity
  settings with Features, all view mode
  settings information will come with
  the code




                        BADCamp, 2011, Tim Cosgrove
Modern Theming
    View Modes entity
     settings in code
‣ If you export node or other entity
  settings with Features, all view mode
  settings information will come with
  the code
‣ Also getable by field_read_instance()
  and settable via
  field_update_instance()

                        BADCamp, 2011, Tim Cosgrove
Modern Theming

Field Formatters




           BADCamp, 2011, Tim Cosgrove
Modern Theming

      Field Formatters
‣ Field API lets you add fields to
  entities, to construct complex
  content types




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

      Field Formatters
‣ Field API lets you add fields to
  entities, to construct complex
  content types
‣ Also lets you construct entirely new,
  custom fields




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

      Field Formatters
‣ Field API lets you add fields to
  entities, to construct complex
  content types
‣ Also lets you construct entirely new,
  custom fields
‣ Or, make custom additions to
  existing fields.


                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Example: External Links




               BADCamp, 2011, Tim Cosgrove
Modern Theming

Example: External Links
‣ On Energy.gov, used
  ext_link_page.module




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Example: External Links
‣ On Energy.gov, used
  ext_link_page.module
‣ Module provides a url_outbound
  alter and an input filter




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Example: External Links
‣ On Energy.gov, used
  ext_link_page.module
‣ Module provides a url_outbound
  alter and an input filter
‣ Problem: we needed to alter links in
  fields where no input filter was
  enabled


                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Solution: custom formatter




                BADCamp, 2011, Tim Cosgrove
Modern Theming

Solution: custom formatter
‣ Establish a new formatter type




                        BADCamp, 2011, Tim Cosgrove
Modern Theming

Solution: custom formatter
‣ Establish a new formatter type
‣ Apply it to existing field types: text,
  long text, and long text with
  summary




                          BADCamp, 2011, Tim Cosgrove
Modern Theming

            hook_field_formatter_info()
/**
* Implements hook_field_formatter_info().
*/
function energy_content_field_formatter_info() {
    return array(
     'energy_content_text_links' => array(
         'label' => t('Plain text with links'),
         'field types' => array('text', 'text_long', 'text_with_summary'),
     ),
    );
}


                                                   BADCamp, 2011, Tim Cosgrove
Modern Theming

            hook_field_formatter_info()
/**
* Implements hook_field_formatter_info().
*/
function energy_content_field_formatter_info() {
    return array(
     'energy_content_text_links' => array(
         'label' => t('Plain text with links'),
         'field types' => array('text', 'text_long', 'text_with_summary'),
     ),
    );
}


                                                   BADCamp, 2011, Tim Cosgrove
Modern Theming

            hook_field_formatter_info()
/**
* Implements hook_field_formatter_info().
*/
function energy_content_field_formatter_info() {
    return array(
     'energy_content_text_links' => array(
         'label' => t('Plain text with links'),
         'field types' => array('text', 'text_long', 'text_with_summary'),
     ),
    );
}


                                                   BADCamp, 2011, Tim Cosgrove
Modern Theming

            hook_field_formatter_info()
/**
* Implements hook_field_formatter_info().
*/
function energy_content_field_formatter_info() {
    return array(
     'energy_content_text_links' => array(
         'label' => t('Plain text with links'),
         'field types' => array('text', 'text_long', 'text_with_summary'),
     ),
    );
}


                                                   BADCamp, 2011, Tim Cosgrove
Modern Theming

            hook_field_formatter_info()
/**
* Implements hook_field_formatter_info().
*/
function energy_content_field_formatter_info() {
    return array(
     'energy_content_text_links' => array(
         'label' => t('Plain text with links'),
         'field types' => array('text', 'text_long', 'text_with_summary'),
     ),
    );
}


                                                   BADCamp, 2011, Tim Cosgrove
Modern Theming

      hook_field_formatter_view()
/**
* Implements hook_field_formatter_view().
*/
function energy_content_field_formatter_view($entity_type, $entity,
$field, $instance, $langcode, $items, $display) {
 $element = array();
 if ($display['type'] === 'energy_content_text_links') {


 // continued...




                                              BADCamp, 2011, Tim Cosgrove
Modern Theming

      hook_field_formatter_view()
/**
* Implements hook_field_formatter_view().
*/
function energy_content_field_formatter_view($entity_type, $entity,
$field, $instance, $langcode, $items, $display) {
 $element = array();
 if ($display['type'] === 'energy_content_text_links') {


 // continued...




                                              BADCamp, 2011, Tim Cosgrove
Modern Theming

      hook_field_formatter_view()
/**
* Implements hook_field_formatter_view().
*/
function energy_content_field_formatter_view($entity_type, $entity,
$field, $instance, $langcode, $items, $display) {
 $element = array();
 if ($display['type'] === 'energy_content_text_links') {


 // continued...




                                              BADCamp, 2011, Tim Cosgrove
Modern Theming

      hook_field_formatter_view()
/**
* Implements hook_field_formatter_view().
*/
function energy_content_field_formatter_view($entity_type, $entity,
$field, $instance, $langcode, $items, $display) {
 $element = array();
 if ($display['type'] === 'energy_content_text_links') {


 // continued...




                                              BADCamp, 2011, Tim Cosgrove
Modern Theming

      hook_field_formatter_view()
/**
* Implements hook_field_formatter_view().
*/
function energy_content_field_formatter_view($entity_type, $entity,
$field, $instance, $langcode, $items, $display) {
 $element = array();
 if ($display['type'] === 'energy_content_text_links') {


 // continued...




                                              BADCamp, 2011, Tim Cosgrove
Modern Theming

                 hook_field_formatter_view()
// ... continued
        foreach ($items as $delta => $item) {
            $output = filter_xss($item['value'], array('a'));
            if (function_exists('_ext_link_page_filter_process')) {
                $output = _ext_link_page_filter_process($output, NULL);
            }
            $element[$delta] = array('#markup' => $output);
        }
    }
    return $element;
}


                                                       BADCamp, 2011, Tim Cosgrove
Modern Theming

                 hook_field_formatter_view()
// ... continued
        foreach ($items as $delta => $item) {
            $output = filter_xss($item['value'], array('a'));
            if (function_exists('_ext_link_page_filter_process')) {
                $output = _ext_link_page_filter_process($output, NULL);
            }
            $element[$delta] = array('#markup' => $output);
        }
    }
    return $element;
}


                                                       BADCamp, 2011, Tim Cosgrove
Modern Theming

                 hook_field_formatter_view()
// ... continued
        foreach ($items as $delta => $item) {
            $output = filter_xss($item['value'], array('a'));
            if (function_exists('_ext_link_page_filter_process')) {
                $output = _ext_link_page_filter_process($output, NULL);
            }
            $element[$delta] = array('#markup' => $output);
        }
    }
    return $element;
}


                                                       BADCamp, 2011, Tim Cosgrove
Modern Theming

Meanwhile, in Manage Display...




                    BADCamp, 2011, Tim Cosgrove
Modern Theming

Meanwhile, in Manage Display...




                    BADCamp, 2011, Tim Cosgrove
Modern Theming

Field Formatters




           BADCamp, 2011, Tim Cosgrove
Modern Theming

     Field Formatters
‣ Advantages




                BADCamp, 2011, Tim Cosgrove
Modern Theming

     Field Formatters
‣ Advantages
 ‣ Highly reusable and extensible




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

     Field Formatters
‣ Advantages
 ‣ Highly reusable and extensible
 ‣ Distributable as module code




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

     Field Formatters
‣ Advantages
 ‣ Highly reusable and extensible
 ‣ Distributable as module code
 ‣ Good in cases where the output is
   not highly stylized



                       BADCamp, 2011, Tim Cosgrove
Modern Theming

Field Formatters




           BADCamp, 2011, Tim Cosgrove
Modern Theming

     Field Formatters
‣ Disadvantages




                   BADCamp, 2011, Tim Cosgrove
Modern Theming

     Field Formatters
‣ Disadvantages
 ‣ If you need style, you need style.
   You still have to theme.




                        BADCamp, 2011, Tim Cosgrove
Modern Theming

     Field Formatters
‣ Disadvantages
 ‣ If you need style, you need style.
   You still have to theme.
 ‣ Code level required may be
   daunting.




                        BADCamp, 2011, Tim Cosgrove
Contrib
Modern Theming

SASS




        BADCamp, 2011, Tim Cosgrove
Modern Theming

              SASS
‣ Syntactically Awesome Style Sheets




                        BADCamp, 2011, Tim Cosgrove
Modern Theming

               SASS
‣ Syntactically Awesome Style Sheets
‣ A Ruby project, but there is a PHP
  port of it and a Drupal module




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

               SASS
‣ Syntactically Awesome Style Sheets
‣ A Ruby project, but there is a PHP
  port of it and a Drupal module
‣ Greatly enhanced syntax for writing
  stylesheets




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

               SASS
‣ Syntactically Awesome Style Sheets
‣ A Ruby project, but there is a PHP
  port of it and a Drupal module
‣ Greatly enhanced syntax for writing
  stylesheets
 ‣ Allows variables and ‘mixins’


                         BADCamp, 2011, Tim Cosgrove
Modern Theming

               SASS
‣ Syntactically Awesome Style Sheets
‣ A Ruby project, but there is a PHP
  port of it and a Drupal module
‣ Greatly enhanced syntax for writing
  stylesheets
 ‣ Allows variables and ‘mixins’
 ‣ Allows nesting
                         BADCamp, 2011, Tim Cosgrove
Modern Theming

Why use SASS?




          BADCamp, 2011, Tim Cosgrove
Modern Theming

        Why use SASS?
‣ It is incredibly faster than writing
  CSS.




                          BADCamp, 2011, Tim Cosgrove
Modern Theming

        Why use SASS?
‣ It is incredibly faster than writing
  CSS.
‣ Your loved ones miss you, and you
  are wasting your life writing CSS.




                          BADCamp, 2011, Tim Cosgrove
Modern Theming

        Why use SASS?
‣ It is incredibly faster than writing
  CSS.
‣ Your loved ones miss you, and you
  are wasting your life writing CSS.




                          BADCamp, 2011, Tim Cosgrove
Modern Theming

        Why use SASS?
‣ It is incredibly faster than writing
  CSS.
‣ Your loved ones miss you, and you
  are wasting your life writing CSS.




                          BADCamp, 2011, Tim Cosgrove
Modern Theming

        Why use SASS?
‣ It is incredibly faster than writing
  CSS.
‣ Your loved ones miss you, and you
  are wasting your life writing CSS.




                          BADCamp, 2011, Tim Cosgrove
Modern Theming

                  SASS Syntax: Nesting
                           SASS                        CSS
.my-selector {                    .my-selector {

    padding-top: 10px;             padding-top: 10px; }

    ul {                           .my-selector ul {

        overflow: hidden;            overflow: hidden; }

        li {                        .my-selector ul li {

            float: left;              float: left;

            margin-right: 10px;      margin-right: 10px; }

        }                           .my-selector ul li.last {

        li.last {                    margin-right: 0; }

            margin-right: 0;
        }
    }
}




                                               BADCamp, 2011, Tim Cosgrove
Modern Theming

                  SASS Syntax: Nesting
                           SASS                        CSS
.my-selector, .my-selector-2 {    .my-selector,
                                  .my-selector-2 {
    padding-top: 10px;             padding-top: 10px; }
    ul, ol {                       .my-selector ol,
                                   .my-selector ul,
        overflow: hidden;           .my-selector-2 ol,
        li {                       .my-selector-2 ul {
                                    overflow: hidden; }
            float: left;             .my-selector ol li,
                                    .my-selector ul li,
            margin-right: 10px;
                                    .my-selector-2 ol li,
        }                           .my-selector-2 ul li {
                                     float: left;
        li.last {                    margin-right: 10px; }
            margin-right: 0;        .my-selector ol li.last,
                                    .my-selector ul li.last,
        }                           .my-selector-2 ol li.last,
    }                               .my-selector-2 ul li.last {
                                     margin-right: 0; }
}




                                               BADCamp, 2011, Tim Cosgrove
SASS Syntax: Nesting
                                    SASS                                           CSS
.ie8, .ie7, .ie6 {                                           .ie6 .primary-nav,
    .primary-nav {                                           .ie7 .primary-nav,
        float: left;
                                                             .ie8 .primary-nav {
        ul.menu li {
                                                              float: left; }
            background-image: url(nav_bg.png);
            background-position: 50%;                         .ie6 .primary-nav ul.menu li,

            :hover {                                          .ie7 .primary-nav ul.menu li,
                background-image: url(nav_bg_active.png);     .ie8 .primary-nav ul.menu li {
            }
                                                               background-image: url(nav_bg.png);
            li {
                                                               background-position: 50%;
                background-image: none;
                :hover {                                        hover-background-image:
                                                            url(nav_bg_active.png); }
                    background-image: none;
                }                                              .ie6 .primary-nav ul.menu li li,

            }                                                  .ie7 .primary-nav ul.menu li li,
        }                                                      .ie8 .primary-nav ul.menu li li {
    }
                                                                 background-image: none;
}
                                                                 hover-background-image: none; }

                                                                              BADCamp, 2011, Tim Cosgrove
Modern Theming

           SASS Syntax: Variables
                        SASS                                   CSS
$standard-border: 1px solid #ededed;     h2 {

$standard-link-color: #138BBA;            border: 1px solid #ededed;

$header-font-family: 'Avenir LT W02 85    font-family: 'Avenir LT W02 85 Heavy',
Heavy', verdana, sans-serif;             verdana, sans-serif; }
                                          h2 a {

h2 {                                       color: #138bba; }
 border: $standard-border;
    font-family: $header-font-family;
    a{
        color: $standard-link-color;
    }
}




                                                     BADCamp, 2011, Tim Cosgrove
Modern Theming

SASS Syntax: Mixins




             BADCamp, 2011, Tim Cosgrove
Modern Theming

          SASS Syntax: Mixins
                  SASS
/* border-radius */
@mixin border-radius($values) {
  -webkit-border-radius: $values;
  -moz-border-radius: $values;
  border-radius: $values;
}




                                     BADCamp, 2011, Tim Cosgrove
Modern Theming

             SASS Syntax: Mixins
                     SASS
/* border-radius */
@mixin border-radius($values) {
  -webkit-border-radius: $values;
  -moz-border-radius: $values;
  border-radius: $values;
}

@mixin basic-gradient($color1, $color2) {
    background-color: $color2;
  filter:
progid:DXImageTransform.Microsoft.gradient
(startColorstr=$color1, endColorstr=
$color2); /* for IE */
 background: -webkit-gradient(linear, left
top, left bottom, from($color1), to($color2)); /
* for webkit browsers */
 background: -moz-linear-gradient(top,
$color1, $color2); /* for firefox 3.6+ */
}




                                                    BADCamp, 2011, Tim Cosgrove
Modern Theming

             SASS Syntax: Mixins
                     SASS
                                                   @mixin standard-button {
/* border-radius */
@mixin border-radius($values) {                      @include basic-gradient(#33a8d6, #0092cc);
  -webkit-border-radius: $values;                    @include border-radius(200px);
  -moz-border-radius: $values;                     }
  border-radius: $values;
}                                                  .my-button {
                                                    @include standard-button;
@mixin basic-gradient($color1, $color2) {          }
    background-color: $color2;
  filter:
progid:DXImageTransform.Microsoft.gradient
(startColorstr=$color1, endColorstr=
$color2); /* for IE */
 background: -webkit-gradient(linear, left
top, left bottom, from($color1), to($color2)); /
* for webkit browsers */
 background: -moz-linear-gradient(top,
$color1, $color2); /* for firefox 3.6+ */
}




                                                                  BADCamp, 2011, Tim Cosgrove
Modern Theming

               SASS Syntax: Mixins
                                               CSS
/* border-radius */
.my-button {
 background-color: #0092cc;
 filter: progid:DXImageTransform.Microsoft.gradient(startColorstr= #33a8d6, endColorstr=
#0092cc);
/* for IE */
 background: -webkit-gradient(linear, left top, left bottom, from(#33a8d6), to(#0092cc));
/* for webkit browsers */
 background: -moz-linear-gradient(top, #33a8d6, #0092cc);
  /* for firefox 3.6+ */
 -webkit-border-radius: 200px;
 -moz-border-radius: 200px;
 border-radius: 200px; }




                                                                 BADCamp, 2011, Tim Cosgrove
Modern Theming

More about SASS




           BADCamp, 2011, Tim Cosgrove
Modern Theming

     More about SASS
‣ Fully CSS compatible (with SASS 3.0
  syntax)




                        BADCamp, 2011, Tim Cosgrove
Modern Theming

     More about SASS
‣ Fully CSS compatible (with SASS 3.0
  syntax)
 ‣ You can drop in existing style, or
   make an existing stylesheet SASSy




                        BADCamp, 2011, Tim Cosgrove
Modern Theming

     More about SASS
‣ Fully CSS compatible (with SASS 3.0
  syntax)
 ‣ You can drop in existing style, or
   make an existing stylesheet SASSy
‣ Drupal module aggregates the
  resulting CSS



                        BADCamp, 2011, Tim Cosgrove
Modern Theming

      More about SASS
‣ Fully CSS compatible (with SASS 3.0
  syntax)
 ‣ You can drop in existing style, or
   make an existing stylesheet SASSy
‣ Drupal module aggregates the
  resulting CSS
‣ It’s super-fun

                        BADCamp, 2011, Tim Cosgrove
Modern Theming

Fieldgroups (field_group)




               BADCamp, 2011, Tim Cosgrove
Modern Theming

Fieldgroups (field_group)
‣ Used to be part of CCK; now a
  separate contrib module




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

Fieldgroups (field_group)
‣ Used to be part of CCK; now a
  separate contrib module
‣ Used to create fieldsets, divs, or
  other containers around groups of
  field output




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

Fieldgroups (field_group)
‣ Used to be part of CCK; now a
  separate contrib module
‣ Used to create fieldsets, divs, or
  other containers around groups of
  field output
‣ Extensible



                       BADCamp, 2011, Tim Cosgrove
Modern Theming

Fieldgroups (field_group)
‣ Used to be part of CCK; now a
  separate contrib module
‣ Used to create fieldsets, divs, or
  other containers around groups of
  field output
‣ Extensible
‣ Can be used to create grid layouts

                        BADCamp, 2011, Tim Cosgrove
Modern Theming

Example: simple column




               BADCamp, 2011, Tim Cosgrove
Modern Theming

Example: simple column




               BADCamp, 2011, Tim Cosgrove
Modern Theming

Example: simple column




               BADCamp, 2011, Tim Cosgrove
Modern Theming

Solution: div with grid classes




                    BADCamp, 2011, Tim Cosgrove
Modern Theming

Solution: div with grid classes




                    BADCamp, 2011, Tim Cosgrove
Modern Theming

Solution: div with grid classes




                    BADCamp, 2011, Tim Cosgrove
Modern Theming

     Custom Fieldgroups
Fieldgroups are CTools Exportables, so
they are (somewhat) easy to write.




                           BADCamp, 2011, Tim Cosgrove
Modern Theming

     Custom Fieldgroups
Fieldgroups are CTools Exportables, so
they are (somewhat) easy to write.




                           BADCamp, 2011, Tim Cosgrove
Modern Theming

     Custom Fieldgroups
Fieldgroups are CTools Exportables, so
they are (somewhat) easy to write.




                           BADCamp, 2011, Tim Cosgrove
Modern Theming

Fieldgroups on admin forms




                 BADCamp, 2011, Tim Cosgrove
Modern Theming

Fieldgroups on admin forms




                 BADCamp, 2011, Tim Cosgrove
Modern Theming

Fieldgroups on admin forms




                 BADCamp, 2011, Tim Cosgrove
Modern Theming

BEANs




        BADCamp, 2011, Tim Cosgrove
Modern Theming

             BEANs
‣ BEANs - Bean Entities Aren’t Nodes




                       BADCamp, 2011, Tim Cosgrove
Modern Theming

             BEANs
‣ BEANs - Bean Entities Aren’t Nodes
 ‣ Fieldable entities that are exposed
   to Drupal’s block system




                        BADCamp, 2011, Tim Cosgrove
Modern Theming

             BEANs
‣ BEANs - Bean Entities Aren’t Nodes
 ‣ Fieldable entities that are exposed
   to Drupal’s block system
 ‣ Can make any number of BEAN
   types which can be re-used




                        BADCamp, 2011, Tim Cosgrove
Modern Theming

             BEANs
‣ BEANs - Bean Entities Aren’t Nodes
 ‣ Fieldable entities that are exposed
   to Drupal’s block system
 ‣ Can make any number of BEAN
   types which can be re-used
 ‣ View modes apply to BEANs, like
   any entity

                        BADCamp, 2011, Tim Cosgrove
Modern Theming

BEANs: Advantages




            BADCamp, 2011, Tim Cosgrove
Modern Theming

    BEANs: Advantages
‣ Fieldable; build a block out of
  existing fields




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

    BEANs: Advantages
‣ Fieldable; build a block out of
  existing fields
‣ Permissions per BEAN type and per
  field, like nodes




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

    BEANs: Advantages
‣ Fieldable; build a block out of
  existing fields
‣ Permissions per BEAN type and per
  field, like nodes
‣ Admin is familiar to users




                         BADCamp, 2011, Tim Cosgrove
Modern Theming

    BEANs: Advantages
‣ Fieldable; build a block out of
  existing fields
‣ Permissions per BEAN type and per
  field, like nodes
‣ Admin is familiar to users
‣ Use of the blocks is familiar to site
  builders.

                          BADCamp, 2011, Tim Cosgrove
Modern Theming

Example: Image & Text




              BADCamp, 2011, Tim Cosgrove
Modern Theming

Example: Image & Text
                    ‣   Label for
                        admin use




              BADCamp, 2011, Tim Cosgrove
Modern Theming

Example: Image & Text
                    ‣   Label for
                        admin use

                    ‣   Title for
                        display




              BADCamp, 2011, Tim Cosgrove
Modern Theming

Example: Image & Text
                    ‣   Label for
                        admin use

                    ‣   Title for
                        display

                    ‣   Media field for
                        image




              BADCamp, 2011, Tim Cosgrove
Modern Theming

Example: Image & Text
                    ‣   Label for
                        admin use

                    ‣   Title for
                        display

                    ‣   Media field for
                        image

                    ‣   User can
                        choose an
                        image style




              BADCamp, 2011, Tim Cosgrove
Modern Theming

Example: Image & Text
                    ‣   Label for
                        admin use

                    ‣   Title for
                        display

                    ‣   Media field for
                        image

                    ‣   User can
                        choose an
                        image style

                    ‣   Optional Text




              BADCamp, 2011, Tim Cosgrove
Modern Theming

Blockreference




          BADCamp, 2011, Tim Cosgrove
Modern Theming

       Blockreference
‣ Like Node Reference for blocks




                        BADCamp, 2011, Tim Cosgrove
Modern Theming

       Blockreference
‣ Like Node Reference for blocks
‣ Allows you to pull rendered blocks
  into a field context




                        BADCamp, 2011, Tim Cosgrove
Modern Theming

       Blockreference
‣ Like Node Reference for blocks
‣ Allows you to pull rendered blocks
  into a field context
‣ All benefits of fields




                          BADCamp, 2011, Tim Cosgrove
Modern Theming

       Blockreference
‣ Like Node Reference for blocks
‣ Allows you to pull rendered blocks
  into a field context
‣ All benefits of fields
 ‣ Reorderable



                          BADCamp, 2011, Tim Cosgrove
Modern Theming

       Blockreference
‣ Like Node Reference for blocks
‣ Allows you to pull rendered blocks
  into a field context
‣ All benefits of fields
 ‣ Reorderable
 ‣ Rendered blocks get search
   indexed as part of node
                          BADCamp, 2011, Tim Cosgrove
Modern Theming
Beans & Blockreference




              BADCamp, 2011, Tim Cosgrove
screenshot of listing
block example, with
highlights like previous
slide
Modern Theming

        Display Suite
‣ Display Suite gives access to many
  of the things described here:
 ‣ View Modes
 ‣ Regions in node content (similar to
   Field Groups)




                        BADCamp, 2011, Tim Cosgrove
Modern Theming

         Display Suite
‣ More capabilities
 ‣ Views and Panels integration
 ‣ Ability to send node content to
   blocks
 ‣ Exportables of all this



                         BADCamp, 2011, Tim Cosgrove
Modern Theming

    Display Suite

 Excellent screencasts at

http://bit.ly/ds-d7




                   BADCamp, 2011, Tim Cosgrove
Modern Theming




Questions?




        BADCamp, 2011, Tim Cosgrove
Modern Theming

Resources
‣ BEAN
  http://drupal.org/project/bean
‣ Block Reference
  http://drupal.org/project/blockreference
‣ SASS
  http://drupal.org/project/bean
‣ Fieldgroup
  http://drupal.org/project/fieldgroup
‣ Display Suite
  http://drupal.org/project/ds

                                   BADCamp, 2011, Tim Cosgrove

More Related Content

Similar to Modern Theming: Beyond Proprocessing and .tpls

[2020 git lab commit] continuous infrastructure
[2020 git lab commit] continuous infrastructure[2020 git lab commit] continuous infrastructure
[2020 git lab commit] continuous infrastructureRodrigo Stefani Domingues
 
GC @ jmaghreb2014
GC @ jmaghreb2014GC @ jmaghreb2014
GC @ jmaghreb2014Ivan Krylov
 
Travailler dans le présent - Chris Heilmann - Paris Web 2008
Travailler dans le présent - Chris Heilmann - Paris Web 2008Travailler dans le présent - Chris Heilmann - Paris Web 2008
Travailler dans le présent - Chris Heilmann - Paris Web 2008Association Paris-Web
 
Working In The Now - Paris Web
Working In The Now - Paris WebWorking In The Now - Paris Web
Working In The Now - Paris WebChristian Heilmann
 
10 Tips for Configuring Your Builds with Bamboo Specs
10 Tips for Configuring Your Builds with Bamboo Specs10 Tips for Configuring Your Builds with Bamboo Specs
10 Tips for Configuring Your Builds with Bamboo SpecsAtlassian
 
Feelin' Groovy: A Groovy Developer in the Java World
Feelin' Groovy: A Groovy Developer in the Java WorldFeelin' Groovy: A Groovy Developer in the Java World
Feelin' Groovy: A Groovy Developer in the Java WorldKen Kousen
 
Kanban highlights
Kanban highlightsKanban highlights
Kanban highlightsYuval Yeret
 
Building a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQLBuilding a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQLYan Cui
 
Abusing the Cloud for Fun and Profit
Abusing the Cloud for Fun and ProfitAbusing the Cloud for Fun and Profit
Abusing the Cloud for Fun and ProfitAlan Pinstein
 
Fast Delivery DevOps Israel
Fast Delivery DevOps IsraelFast Delivery DevOps Israel
Fast Delivery DevOps IsraelAdrian Cockcroft
 
Drupaldelphia Shortcuts Cheats And Cheap Stunts
Drupaldelphia  Shortcuts Cheats And Cheap StuntsDrupaldelphia  Shortcuts Cheats And Cheap Stunts
Drupaldelphia Shortcuts Cheats And Cheap Stuntscanarymason
 
Build social network in 4 weeks
Build social network in 4 weeksBuild social network in 4 weeks
Build social network in 4 weeksYan Cui
 
Understanding and building Your Own Docker
Understanding and building Your Own DockerUnderstanding and building Your Own Docker
Understanding and building Your Own DockerMotiejus Jakštys
 
MongoDB World 2019: Don't Panic - The Hitchhiker's Guide to the MongoDB Galaxy
MongoDB World 2019: Don't Panic - The Hitchhiker's Guide to the MongoDB GalaxyMongoDB World 2019: Don't Panic - The Hitchhiker's Guide to the MongoDB Galaxy
MongoDB World 2019: Don't Panic - The Hitchhiker's Guide to the MongoDB GalaxyMongoDB
 
Your Goat Antifragiled My Snowflake!: Demystifying DevOps Jargon - ChefConf 2015
Your Goat Antifragiled My Snowflake!: Demystifying DevOps Jargon - ChefConf 2015Your Goat Antifragiled My Snowflake!: Demystifying DevOps Jargon - ChefConf 2015
Your Goat Antifragiled My Snowflake!: Demystifying DevOps Jargon - ChefConf 2015Chef
 
Metasepi team meeting #16: Safety on ATS language + MCU
Metasepi team meeting #16: Safety on ATS language + MCUMetasepi team meeting #16: Safety on ATS language + MCU
Metasepi team meeting #16: Safety on ATS language + MCUKiwamu Okabe
 
Максим Ткачук - «Маленькие советы дизайнерам»
Максим Ткачук - «Маленькие советы дизайнерам»Максим Ткачук - «Маленькие советы дизайнерам»
Максим Ткачук - «Маленькие советы дизайнерам»ПрофсоUX
 
Can we fix dev-oops ?
Can we fix dev-oops ?Can we fix dev-oops ?
Can we fix dev-oops ?Kris Buytaert
 
ChefConf 2014 - Kanban will save You! Will it?
ChefConf 2014 - Kanban will save You! Will it?ChefConf 2014 - Kanban will save You! Will it?
ChefConf 2014 - Kanban will save You! Will it?Marcin Mazurek
 
WebGL Camp 4 - A3 3D Engine
WebGL Camp 4 - A3 3D EngineWebGL Camp 4 - A3 3D Engine
WebGL Camp 4 - A3 3D Engineaerotwist
 

Similar to Modern Theming: Beyond Proprocessing and .tpls (20)

[2020 git lab commit] continuous infrastructure
[2020 git lab commit] continuous infrastructure[2020 git lab commit] continuous infrastructure
[2020 git lab commit] continuous infrastructure
 
GC @ jmaghreb2014
GC @ jmaghreb2014GC @ jmaghreb2014
GC @ jmaghreb2014
 
Travailler dans le présent - Chris Heilmann - Paris Web 2008
Travailler dans le présent - Chris Heilmann - Paris Web 2008Travailler dans le présent - Chris Heilmann - Paris Web 2008
Travailler dans le présent - Chris Heilmann - Paris Web 2008
 
Working In The Now - Paris Web
Working In The Now - Paris WebWorking In The Now - Paris Web
Working In The Now - Paris Web
 
10 Tips for Configuring Your Builds with Bamboo Specs
10 Tips for Configuring Your Builds with Bamboo Specs10 Tips for Configuring Your Builds with Bamboo Specs
10 Tips for Configuring Your Builds with Bamboo Specs
 
Feelin' Groovy: A Groovy Developer in the Java World
Feelin' Groovy: A Groovy Developer in the Java WorldFeelin' Groovy: A Groovy Developer in the Java World
Feelin' Groovy: A Groovy Developer in the Java World
 
Kanban highlights
Kanban highlightsKanban highlights
Kanban highlights
 
Building a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQLBuilding a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQL
 
Abusing the Cloud for Fun and Profit
Abusing the Cloud for Fun and ProfitAbusing the Cloud for Fun and Profit
Abusing the Cloud for Fun and Profit
 
Fast Delivery DevOps Israel
Fast Delivery DevOps IsraelFast Delivery DevOps Israel
Fast Delivery DevOps Israel
 
Drupaldelphia Shortcuts Cheats And Cheap Stunts
Drupaldelphia  Shortcuts Cheats And Cheap StuntsDrupaldelphia  Shortcuts Cheats And Cheap Stunts
Drupaldelphia Shortcuts Cheats And Cheap Stunts
 
Build social network in 4 weeks
Build social network in 4 weeksBuild social network in 4 weeks
Build social network in 4 weeks
 
Understanding and building Your Own Docker
Understanding and building Your Own DockerUnderstanding and building Your Own Docker
Understanding and building Your Own Docker
 
MongoDB World 2019: Don't Panic - The Hitchhiker's Guide to the MongoDB Galaxy
MongoDB World 2019: Don't Panic - The Hitchhiker's Guide to the MongoDB GalaxyMongoDB World 2019: Don't Panic - The Hitchhiker's Guide to the MongoDB Galaxy
MongoDB World 2019: Don't Panic - The Hitchhiker's Guide to the MongoDB Galaxy
 
Your Goat Antifragiled My Snowflake!: Demystifying DevOps Jargon - ChefConf 2015
Your Goat Antifragiled My Snowflake!: Demystifying DevOps Jargon - ChefConf 2015Your Goat Antifragiled My Snowflake!: Demystifying DevOps Jargon - ChefConf 2015
Your Goat Antifragiled My Snowflake!: Demystifying DevOps Jargon - ChefConf 2015
 
Metasepi team meeting #16: Safety on ATS language + MCU
Metasepi team meeting #16: Safety on ATS language + MCUMetasepi team meeting #16: Safety on ATS language + MCU
Metasepi team meeting #16: Safety on ATS language + MCU
 
Максим Ткачук - «Маленькие советы дизайнерам»
Максим Ткачук - «Маленькие советы дизайнерам»Максим Ткачук - «Маленькие советы дизайнерам»
Максим Ткачук - «Маленькие советы дизайнерам»
 
Can we fix dev-oops ?
Can we fix dev-oops ?Can we fix dev-oops ?
Can we fix dev-oops ?
 
ChefConf 2014 - Kanban will save You! Will it?
ChefConf 2014 - Kanban will save You! Will it?ChefConf 2014 - Kanban will save You! Will it?
ChefConf 2014 - Kanban will save You! Will it?
 
WebGL Camp 4 - A3 3D Engine
WebGL Camp 4 - A3 3D EngineWebGL Camp 4 - A3 3D Engine
WebGL Camp 4 - A3 3D Engine
 

More from Treehouse Agency

Dcnyc10 build a better drupal agency
Dcnyc10 build a better drupal agencyDcnyc10 build a better drupal agency
Dcnyc10 build a better drupal agencyTreehouse Agency
 
Strategic Management of Multiple Projects (aka Project Whispering)
Strategic Management of Multiple Projects (aka Project Whispering)Strategic Management of Multiple Projects (aka Project Whispering)
Strategic Management of Multiple Projects (aka Project Whispering)Treehouse Agency
 
Project Management as an Art Form
Project Management as an Art FormProject Management as an Art Form
Project Management as an Art FormTreehouse Agency
 
Scaling Drupal: Not IF... HOW
Scaling Drupal: Not IF... HOWScaling Drupal: Not IF... HOW
Scaling Drupal: Not IF... HOWTreehouse Agency
 
The Case for Drupal in the Enterprise
The Case for Drupal in the EnterpriseThe Case for Drupal in the Enterprise
The Case for Drupal in the EnterpriseTreehouse Agency
 

More from Treehouse Agency (10)

Dcnyc10 build a better drupal agency
Dcnyc10 build a better drupal agencyDcnyc10 build a better drupal agency
Dcnyc10 build a better drupal agency
 
Vagrant puppet
Vagrant puppetVagrant puppet
Vagrant puppet
 
Front endnyc
Front endnycFront endnyc
Front endnyc
 
Strategic Management of Multiple Projects (aka Project Whispering)
Strategic Management of Multiple Projects (aka Project Whispering)Strategic Management of Multiple Projects (aka Project Whispering)
Strategic Management of Multiple Projects (aka Project Whispering)
 
Project whispering-v1
Project whispering-v1Project whispering-v1
Project whispering-v1
 
Leaving you.v3
Leaving you.v3Leaving you.v3
Leaving you.v3
 
Project Management as an Art Form
Project Management as an Art FormProject Management as an Art Form
Project Management as an Art Form
 
Ctools UI Presentation
Ctools UI PresentationCtools UI Presentation
Ctools UI Presentation
 
Scaling Drupal: Not IF... HOW
Scaling Drupal: Not IF... HOWScaling Drupal: Not IF... HOW
Scaling Drupal: Not IF... HOW
 
The Case for Drupal in the Enterprise
The Case for Drupal in the EnterpriseThe Case for Drupal in the Enterprise
The Case for Drupal in the Enterprise
 

Recently uploaded

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 

Recently uploaded (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 

Modern Theming: Beyond Proprocessing and .tpls

  • 1. Modern Theming: Beyond Preprocessing and .tpls BADCamp October 22, 2011 Tim Cosgrove
  • 2. Modern Theming Tim Cosgrove BADCamp, 2011, Tim Cosgrove
  • 3. Modern Theming Tim Cosgrove ‣ Engineer and Tech PM BADCamp, 2011, Tim Cosgrove
  • 4. Modern Theming Tim Cosgrove ‣ Engineer and Tech PM ‣ Treehouse Agency BADCamp, 2011, Tim Cosgrove
  • 5. Modern Theming Tim Cosgrove ‣ Engineer and Tech PM ‣ Treehouse Agency ‣ Drupal.org member since February 2007 BADCamp, 2011, Tim Cosgrove
  • 6. Modern Theming Tim Cosgrove ‣ Engineer and Tech PM ‣ Treehouse Agency ‣ Drupal.org member since February 2007 ‣ Web Developer since 1998 BADCamp, 2011, Tim Cosgrove
  • 7. Modern Theming Tim Cosgrove ‣ Engineer and Tech PM ‣ Treehouse Agency ‣ Drupal.org member since February 2007 ‣ Web Developer since 1998 ‣ @timcosgrove BADCamp, 2011, Tim Cosgrove
  • 8. Modern Theming Modern Theming BADCamp, 2011, Tim Cosgrove
  • 9. Modern Theming Themers are Developers BADCamp, 2011, Tim Cosgrove
  • 10. Modern Theming Themers are Developers BADCamp, 2011, Tim Cosgrove
  • 11. Modern Theming Themers are Developers BADCamp, 2011, Tim Cosgrove
  • 12. Modern Theming Themers are Developers ‣ Much of what is display-related ends up in modules, not themes. BADCamp, 2011, Tim Cosgrove
  • 13. Modern Theming Themers are Developers ‣ Much of what is display-related ends up in modules, not themes. ‣ In Drupal, there is a grey area between what is theming and what is not theming. BADCamp, 2011, Tim Cosgrove
  • 14. Modern Theming Themers are Developers ‣ Much of what is display-related ends up in modules, not themes. ‣ In Drupal, there is a grey area between what is theming and what is not theming. ‣ You write PHP. You are a nerd. Embrace it! BADCamp, 2011, Tim Cosgrove
  • 15. Modern Theming “Modern Theming”? BADCamp, 2011, Tim Cosgrove
  • 16. Modern Theming “Modern Theming”? ‣ Use as much of Core as possible BADCamp, 2011, Tim Cosgrove
  • 17. Modern Theming “Modern Theming”? ‣ Use as much of Core as possible ‣ Use module code, write module code BADCamp, 2011, Tim Cosgrove
  • 18. Modern Theming “Modern Theming”? ‣ Use as much of Core as possible ‣ Use module code, write module code ‣ Or, learn what can be done so you can tell your developers what you need BADCamp, 2011, Tim Cosgrove
  • 19. Modern Theming “Modern Theming”? ‣ Use as much of Core as possible ‣ Use module code, write module code ‣ Or, learn what can be done so you can tell your developers what you need ‣ Use newer technologies where appropriate BADCamp, 2011, Tim Cosgrove
  • 20. Modern Theming “Modern Theming”? ‣ Use as much of Core as possible ‣ Use module code, write module code ‣ Or, learn what can be done so you can tell your developers what you need ‣ Use newer technologies where appropriate ‣ Avoid the pile-up of .tpls BADCamp, 2011, Tim Cosgrove
  • 21. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 22. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 23. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 24. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 25. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 26. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 27. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 28. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 29. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 30. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 31. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 32. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 33. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 34. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 35. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 36. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 37. Modern Theming DO NOT DO BADCamp, 2011, Tim Cosgrove
  • 38. Modern Theming In general, try to forget Drupal 5 and 6. BADCamp, 2011, Tim Cosgrove
  • 39. Modern Theming In general, try to forget Drupal 5 and 6. ‣ Forget dozens of templates. BADCamp, 2011, Tim Cosgrove
  • 40. Modern Theming In general, try to forget Drupal 5 and 6. ‣ Forget dozens of templates. ‣ Forget dozens of preprocess functions. BADCamp, 2011, Tim Cosgrove
  • 41. Modern Theming In general, try to forget Drupal 5 and 6. ‣ Forget dozens of templates. ‣ Forget dozens of preprocess functions. ‣ Forget base themes. BADCamp, 2011, Tim Cosgrove
  • 42. Modern Theming In general, try to forget Drupal 5 and 6. ‣ Forget dozens of templates. ‣ Forget dozens of preprocess functions. ‣ Forget base themes. ‣ (...though, you can still use all that, and it might be appropriate.) BADCamp, 2011, Tim Cosgrove
  • 43. Modern Theming Theming Modernly: GRIDS BADCamp, 2011, Tim Cosgrove
  • 44. Modern Theming Theming Modernly: GRIDS ‣ You should insist on a grid design. BADCamp, 2011, Tim Cosgrove
  • 45. Modern Theming Theming Modernly: GRIDS ‣ You should insist on a grid design. ‣ The coherent visual layout makes finding information easier. BADCamp, 2011, Tim Cosgrove
  • 46. Modern Theming Theming Modernly: GRIDS ‣ You should insist on a grid design. ‣ The coherent visual layout makes finding information easier. ‣ It allows for design and editorial elements to move around. BADCamp, 2011, Tim Cosgrove
  • 47. Modern Theming Theming Modernly: GRIDS ‣ You should insist on a grid design. ‣ The coherent visual layout makes finding information easier. ‣ It allows for design and editorial elements to move around. ‣ It saves you time which saves them money. BADCamp, 2011, Tim Cosgrove
  • 48.
  • 49.
  • 50.
  • 51.
  • 52. screenshot of listing block example, with highlights like previous slide
  • 53. screenshot of listing block example, with highlights like previous slide
  • 54. Modern Theming Why Grids are Helpful BADCamp, 2011, Tim Cosgrove
  • 55. Modern Theming Why Grids are Helpful ‣ Items of the same number of units are interchangeable BADCamp, 2011, Tim Cosgrove
  • 56. Modern Theming Why Grids are Helpful ‣ Items of the same number of units are interchangeable ‣ With the right image style settings and CSS, you can drop things in and they will just work BADCamp, 2011, Tim Cosgrove
  • 57.
  • 58.
  • 59. `
  • 60. Modern Theming Repeating elements BADCamp, 2011, Tim Cosgrove
  • 61. Modern Theming Repeating elements ‣ Look for items that are similar and can be reused BADCamp, 2011, Tim Cosgrove
  • 62. Modern Theming Repeating elements ‣ Look for items that are similar and can be reused ‣ Look for inconsistencies; see if they can be unified BADCamp, 2011, Tim Cosgrove
  • 63. Modern Theming Repeating elements ‣ Look for items that are similar and can be reused ‣ Look for inconsistencies; see if they can be unified ‣ Again, saves time and money BADCamp, 2011, Tim Cosgrove
  • 64. Modern Theming Different Content, Same Display BADCamp, 2011, Tim Cosgrove
  • 65. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 66. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 67. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 68. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 69. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 70. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 71. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 72. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 73. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 74. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 75. Modern Theming Same Content, Different Displays BADCamp, 2011, Tim Cosgrove
  • 76. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 77. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 78. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 79. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 80. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 81. Core
  • 82. Modern Theming Drupal 7 only - why? BADCamp, 2011, Tim Cosgrove
  • 83. Modern Theming Drupal 7 only - why? ‣ Released January 5, 2011 - coming up on a year BADCamp, 2011, Tim Cosgrove
  • 84. Modern Theming Drupal 7 only - why? ‣ Released January 5, 2011 - coming up on a year ‣ Drupal 6 will stopped being supported in about 2-3 years BADCamp, 2011, Tim Cosgrove
  • 85. Modern Theming Drupal 7 only - why? ‣ Released January 5, 2011 - coming up on a year ‣ Drupal 6 will stopped being supported in about 2-3 years ‣ No security updates BADCamp, 2011, Tim Cosgrove
  • 86. Modern Theming Drupal 7 only - why? ‣ Released January 5, 2011 - coming up on a year ‣ Drupal 6 will stopped being supported in about 2-3 years ‣ No security updates ‣ Most widely-used contrib modules have at least an alpha out now BADCamp, 2011, Tim Cosgrove
  • 87. Modern Theming also... BADCamp, 2011, Tim Cosgrove
  • 88. Modern Theming Drupal 7 is actually good! BADCamp, 2011, Tim Cosgrove
  • 89. Modern Theming Drupal 7 is actually good! ‣ Theming improvements: BADCamp, 2011, Tim Cosgrove
  • 90. Modern Theming Drupal 7 is actually good! ‣ Theming improvements: ‣ Fields in core BADCamp, 2011, Tim Cosgrove
  • 91. Modern Theming Drupal 7 is actually good! ‣ Theming improvements: ‣ Fields in core ‣ preprocess() and process() BADCamp, 2011, Tim Cosgrove
  • 92. Modern Theming Drupal 7 is actually good! ‣ Theming improvements: ‣ Fields in core ‣ preprocess() and process() ‣ Render array BADCamp, 2011, Tim Cosgrove
  • 93. Modern Theming Drupal 7 is actually good! ‣ Theming improvements: ‣ Fields in core ‣ preprocess() and process() ‣ Render array ‣ Theme hook suggestions BADCamp, 2011, Tim Cosgrove
  • 94. Modern Theming Drupal 7 is actually good! ‣ Theming improvements: ‣ Fields in core ‣ preprocess() and process() ‣ Render array ‣ Theme hook suggestions ‣ Core theming is usable! BADCamp, 2011, Tim Cosgrove
  • 95. Modern Theming Drupal 7 is actually good! ‣ Theming improvements: ‣ Fields in core ‣ preprocess() and process() ‣ Render array ‣ Theme hook suggestions ‣ Core theming is usable! ‣ No, really! BADCamp, 2011, Tim Cosgrove
  • 96. Modern Theming Base theme? Nope. BADCamp, 2011, Tim Cosgrove
  • 97. Modern Theming Base theme? Nope. ‣ We use core theming as our starting point. BADCamp, 2011, Tim Cosgrove
  • 98. Modern Theming Base theme? Nope. ‣ We use core theming as our starting point. ‣ .info, reset.css, and a grid system. BADCamp, 2011, Tim Cosgrove
  • 99. Modern Theming Base theme? Nope. ‣ We use core theming as our starting point. ‣ .info, reset.css, and a grid system. ‣ Core templates produce usable markup. BADCamp, 2011, Tim Cosgrove
  • 100. Modern Theming Base theme? Nope. ‣ We use core theming as our starting point. ‣ .info, reset.css, and a grid system. ‣ Core templates produce usable markup. ‣ Base themes make assumptions about how you want to theme. BADCamp, 2011, Tim Cosgrove
  • 101. Modern Theming Base theme? Nope. ‣ We use core theming as our starting point. ‣ .info, reset.css, and a grid system. ‣ Core templates produce usable markup. ‣ Base themes make assumptions about how you want to theme. ‣ ...which is maybe OK. BADCamp, 2011, Tim Cosgrove
  • 102. Modern Theming View Modes BADCamp, 2011, Tim Cosgrove
  • 103. Modern Theming What are View Modes? BADCamp, 2011, Tim Cosgrove
  • 104. Modern Theming What are View Modes? ‣ View Modes are awesome. BADCamp, 2011, Tim Cosgrove
  • 105. Modern Theming What are View Modes? ‣ View Modes are awesome. ‣ Named ways of displaying the same entity differently (node, user, custom) BADCamp, 2011, Tim Cosgrove
  • 106. Modern Theming What are View Modes? ‣ View Modes are awesome. ‣ Named ways of displaying the same entity differently (node, user, custom) ‣ Allows you to define display settings for anything fieldable BADCamp, 2011, Tim Cosgrove
  • 107. Modern Theming What are View Modes? ‣ View Modes are awesome. ‣ Named ways of displaying the same entity differently (node, user, custom) ‣ Allows you to define display settings for anything fieldable ‣ You’re already using them BADCamp, 2011, Tim Cosgrove
  • 108.
  • 109.
  • 111. Modern Theming Built-in View Modes BADCamp, 2011, Tim Cosgrove
  • 112. Modern Theming Built-in View Modes ‣ Teaser and Default, active by default BADCamp, 2011, Tim Cosgrove
  • 113. Modern Theming Built-in View Modes ‣ Teaser and Default, active by default ‣ Core also includes view modes for BADCamp, 2011, Tim Cosgrove
  • 114. Modern Theming Built-in View Modes ‣ Teaser and Default, active by default ‣ Core also includes view modes for ‣ “full” BADCamp, 2011, Tim Cosgrove
  • 115. Modern Theming Built-in View Modes ‣ Teaser and Default, active by default ‣ Core also includes view modes for ‣ “full” ‣ RSS BADCamp, 2011, Tim Cosgrove
  • 116. Modern Theming Built-in View Modes ‣ Teaser and Default, active by default ‣ Core also includes view modes for ‣ “full” ‣ RSS ‣ search index BADCamp, 2011, Tim Cosgrove
  • 117. Modern Theming Built-in View Modes ‣ Teaser and Default, active by default ‣ Core also includes view modes for ‣ “full” ‣ RSS ‣ search index ‣ search results BADCamp, 2011, Tim Cosgrove
  • 118.
  • 119.
  • 120. Modern Theming But why stop there? BADCamp, 2011, Tim Cosgrove
  • 121. Modern Theming But why stop there? All of these are potential view modes BADCamp, 2011, Tim Cosgrove
  • 122. Modern Theming But why stop there? All of these are potential view modes BADCamp, 2011, Tim Cosgrove
  • 123. Modern Theming But why stop there? All of these are potential view modes BADCamp, 2011, Tim Cosgrove
  • 124. Modern Theming But why stop there? All of these are potential view modes BADCamp, 2011, Tim Cosgrove
  • 125. Modern Theming But why stop there? All of these are potential view modes BADCamp, 2011, Tim Cosgrove
  • 126. Modern Theming But why stop there? All of these are potential view modes BADCamp, 2011, Tim Cosgrove
  • 127. Modern Theming But why stop there? All of these are potential view modes BADCamp, 2011, Tim Cosgrove
  • 128. Modern Theming But why stop there? All of these are potential view modes BADCamp, 2011, Tim Cosgrove
  • 129. Modern Theming Why is this useful? BADCamp, 2011, Tim Cosgrove
  • 130. Modern Theming Why is this useful? ‣ Different node types (or entities) can share view mode names. BADCamp, 2011, Tim Cosgrove
  • 131. Modern Theming Why is this useful? ‣ Different node types (or entities) can share view mode names. Contributor BADCamp, 2011, Tim Cosgrove
  • 132. Modern Theming Why is this useful? ‣ Different node types (or entities) can share view mode names. Contributor Article BADCamp, 2011, Tim Cosgrove
  • 133. Modern Theming Why is this useful? ‣ Different node types (or entities) can share view mode names. Contributor Article Video BADCamp, 2011, Tim Cosgrove
  • 134. Modern Theming Why is this useful? ‣ Different node types (or entities) can share view mode names. Contributor Article Video ‣ Different field sources, same (or similar) display BADCamp, 2011, Tim Cosgrove
  • 135. Modern Theming Different contexts BADCamp, 2011, Tim Cosgrove
  • 136. Modern Theming Different contexts ‣ View Modes can be used to render entities in: BADCamp, 2011, Tim Cosgrove
  • 137. Modern Theming Different contexts ‣ View Modes can be used to render entities in: ‣ Views BADCamp, 2011, Tim Cosgrove
  • 138. Modern Theming Different contexts ‣ View Modes can be used to render entities in: ‣ Views ‣ Reference fields BADCamp, 2011, Tim Cosgrove
  • 139. Modern Theming Different contexts ‣ View Modes can be used to render entities in: ‣ Views ‣ Reference fields ‣ Beans / block entities BADCamp, 2011, Tim Cosgrove
  • 140. Modern Theming Different contexts ‣ View Modes can be used to render entities in: ‣ Views ‣ Reference fields ‣ Beans / block entities ‣ Any custom callback or block BADCamp, 2011, Tim Cosgrove
  • 141. Modern Theming BADCamp, 2011, Tim Cosgrove
  • 142. Modern Theming View Modes in Code /** * Implements hook_entity_info_alter(). */ function energy_content_entity_info_alter(&$info) { $info['node']['view modes'] += array( 'block_teaser' => array( 'label' => t('Block teaser'), 'custom settings' => TRUE, ), ); } BADCamp, 2011, Tim Cosgrove
  • 143. Modern Theming View Modes in Code /** * Implements hook_entity_info_alter(). */ function energy_content_entity_info_alter(&$info) { $info['node']['view modes'] += array( 'block_teaser' => array( 'label' => t('Block teaser'), 'custom settings' => TRUE, ), ); } BADCamp, 2011, Tim Cosgrove
  • 144. Modern Theming View Modes in Code /** * Implements hook_entity_info_alter(). */ function energy_content_entity_info_alter(&$info) { $info['node']['view modes'] += array( 'block_teaser' => array( 'label' => t('Block teaser'), 'custom settings' => TRUE, ), ); } BADCamp, 2011, Tim Cosgrove
  • 145. Modern Theming View Modes in Code /** * Implements hook_entity_info_alter(). */ function energy_content_entity_info_alter(&$info) { $info['node']['view modes'] += array( 'block_teaser' => array( 'label' => t('Block teaser'), 'custom settings' => TRUE, ), ); } BADCamp, 2011, Tim Cosgrove
  • 146. Modern Theming View Modes in Code /** * Implements hook_entity_info_alter(). */ function energy_content_entity_info_alter(&$info) { $info['node']['view modes'] += array( 'block_teaser' => array( 'label' => t('Block teaser'), 'custom settings' => TRUE, ), ); } BADCamp, 2011, Tim Cosgrove
  • 147. Modern Theming View Modes in Code /** * Implements hook_entity_info_alter(). */ function energy_content_entity_info_alter(&$info) { $info['node']['view modes'] += array( 'block_teaser' => array( 'label' => t('Block teaser'), 'custom settings' => TRUE, ), ); } BADCamp, 2011, Tim Cosgrove
  • 148. Modern Theming View Modes in Code /** * Implements hook_entity_info_alter(). */ function energy_content_entity_info_alter(&$info) { $info['node']['view modes'] += array( 'block_teaser' => array( 'label' => t('Block teaser'), 'custom settings' => TRUE, ), ); } BADCamp, 2011, Tim Cosgrove
  • 149. Modern Theming ...or you can use Display Suite. But we’ll come back to that. BADCamp, 2011, Tim Cosgrove
  • 150. O HAI
  • 151. O HAI
  • 152. Modern Theming View Modes entity settings in code BADCamp, 2011, Tim Cosgrove
  • 153. Modern Theming View Modes entity settings in code ‣ If you export node or other entity settings with Features, all view mode settings information will come with the code BADCamp, 2011, Tim Cosgrove
  • 154. Modern Theming View Modes entity settings in code ‣ If you export node or other entity settings with Features, all view mode settings information will come with the code ‣ Also getable by field_read_instance() and settable via field_update_instance() BADCamp, 2011, Tim Cosgrove
  • 155. Modern Theming Field Formatters BADCamp, 2011, Tim Cosgrove
  • 156. Modern Theming Field Formatters ‣ Field API lets you add fields to entities, to construct complex content types BADCamp, 2011, Tim Cosgrove
  • 157. Modern Theming Field Formatters ‣ Field API lets you add fields to entities, to construct complex content types ‣ Also lets you construct entirely new, custom fields BADCamp, 2011, Tim Cosgrove
  • 158. Modern Theming Field Formatters ‣ Field API lets you add fields to entities, to construct complex content types ‣ Also lets you construct entirely new, custom fields ‣ Or, make custom additions to existing fields. BADCamp, 2011, Tim Cosgrove
  • 159. Modern Theming Example: External Links BADCamp, 2011, Tim Cosgrove
  • 160. Modern Theming Example: External Links ‣ On Energy.gov, used ext_link_page.module BADCamp, 2011, Tim Cosgrove
  • 161. Modern Theming Example: External Links ‣ On Energy.gov, used ext_link_page.module ‣ Module provides a url_outbound alter and an input filter BADCamp, 2011, Tim Cosgrove
  • 162. Modern Theming Example: External Links ‣ On Energy.gov, used ext_link_page.module ‣ Module provides a url_outbound alter and an input filter ‣ Problem: we needed to alter links in fields where no input filter was enabled BADCamp, 2011, Tim Cosgrove
  • 163. Modern Theming Solution: custom formatter BADCamp, 2011, Tim Cosgrove
  • 164. Modern Theming Solution: custom formatter ‣ Establish a new formatter type BADCamp, 2011, Tim Cosgrove
  • 165. Modern Theming Solution: custom formatter ‣ Establish a new formatter type ‣ Apply it to existing field types: text, long text, and long text with summary BADCamp, 2011, Tim Cosgrove
  • 166. Modern Theming hook_field_formatter_info() /** * Implements hook_field_formatter_info(). */ function energy_content_field_formatter_info() { return array( 'energy_content_text_links' => array( 'label' => t('Plain text with links'), 'field types' => array('text', 'text_long', 'text_with_summary'), ), ); } BADCamp, 2011, Tim Cosgrove
  • 167. Modern Theming hook_field_formatter_info() /** * Implements hook_field_formatter_info(). */ function energy_content_field_formatter_info() { return array( 'energy_content_text_links' => array( 'label' => t('Plain text with links'), 'field types' => array('text', 'text_long', 'text_with_summary'), ), ); } BADCamp, 2011, Tim Cosgrove
  • 168. Modern Theming hook_field_formatter_info() /** * Implements hook_field_formatter_info(). */ function energy_content_field_formatter_info() { return array( 'energy_content_text_links' => array( 'label' => t('Plain text with links'), 'field types' => array('text', 'text_long', 'text_with_summary'), ), ); } BADCamp, 2011, Tim Cosgrove
  • 169. Modern Theming hook_field_formatter_info() /** * Implements hook_field_formatter_info(). */ function energy_content_field_formatter_info() { return array( 'energy_content_text_links' => array( 'label' => t('Plain text with links'), 'field types' => array('text', 'text_long', 'text_with_summary'), ), ); } BADCamp, 2011, Tim Cosgrove
  • 170. Modern Theming hook_field_formatter_info() /** * Implements hook_field_formatter_info(). */ function energy_content_field_formatter_info() { return array( 'energy_content_text_links' => array( 'label' => t('Plain text with links'), 'field types' => array('text', 'text_long', 'text_with_summary'), ), ); } BADCamp, 2011, Tim Cosgrove
  • 171. Modern Theming hook_field_formatter_view() /** * Implements hook_field_formatter_view(). */ function energy_content_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { $element = array(); if ($display['type'] === 'energy_content_text_links') { // continued... BADCamp, 2011, Tim Cosgrove
  • 172. Modern Theming hook_field_formatter_view() /** * Implements hook_field_formatter_view(). */ function energy_content_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { $element = array(); if ($display['type'] === 'energy_content_text_links') { // continued... BADCamp, 2011, Tim Cosgrove
  • 173. Modern Theming hook_field_formatter_view() /** * Implements hook_field_formatter_view(). */ function energy_content_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { $element = array(); if ($display['type'] === 'energy_content_text_links') { // continued... BADCamp, 2011, Tim Cosgrove
  • 174. Modern Theming hook_field_formatter_view() /** * Implements hook_field_formatter_view(). */ function energy_content_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { $element = array(); if ($display['type'] === 'energy_content_text_links') { // continued... BADCamp, 2011, Tim Cosgrove
  • 175. Modern Theming hook_field_formatter_view() /** * Implements hook_field_formatter_view(). */ function energy_content_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { $element = array(); if ($display['type'] === 'energy_content_text_links') { // continued... BADCamp, 2011, Tim Cosgrove
  • 176. Modern Theming hook_field_formatter_view() // ... continued foreach ($items as $delta => $item) { $output = filter_xss($item['value'], array('a')); if (function_exists('_ext_link_page_filter_process')) { $output = _ext_link_page_filter_process($output, NULL); } $element[$delta] = array('#markup' => $output); } } return $element; } BADCamp, 2011, Tim Cosgrove
  • 177. Modern Theming hook_field_formatter_view() // ... continued foreach ($items as $delta => $item) { $output = filter_xss($item['value'], array('a')); if (function_exists('_ext_link_page_filter_process')) { $output = _ext_link_page_filter_process($output, NULL); } $element[$delta] = array('#markup' => $output); } } return $element; } BADCamp, 2011, Tim Cosgrove
  • 178. Modern Theming hook_field_formatter_view() // ... continued foreach ($items as $delta => $item) { $output = filter_xss($item['value'], array('a')); if (function_exists('_ext_link_page_filter_process')) { $output = _ext_link_page_filter_process($output, NULL); } $element[$delta] = array('#markup' => $output); } } return $element; } BADCamp, 2011, Tim Cosgrove
  • 179. Modern Theming Meanwhile, in Manage Display... BADCamp, 2011, Tim Cosgrove
  • 180. Modern Theming Meanwhile, in Manage Display... BADCamp, 2011, Tim Cosgrove
  • 181. Modern Theming Field Formatters BADCamp, 2011, Tim Cosgrove
  • 182. Modern Theming Field Formatters ‣ Advantages BADCamp, 2011, Tim Cosgrove
  • 183. Modern Theming Field Formatters ‣ Advantages ‣ Highly reusable and extensible BADCamp, 2011, Tim Cosgrove
  • 184. Modern Theming Field Formatters ‣ Advantages ‣ Highly reusable and extensible ‣ Distributable as module code BADCamp, 2011, Tim Cosgrove
  • 185. Modern Theming Field Formatters ‣ Advantages ‣ Highly reusable and extensible ‣ Distributable as module code ‣ Good in cases where the output is not highly stylized BADCamp, 2011, Tim Cosgrove
  • 186. Modern Theming Field Formatters BADCamp, 2011, Tim Cosgrove
  • 187. Modern Theming Field Formatters ‣ Disadvantages BADCamp, 2011, Tim Cosgrove
  • 188. Modern Theming Field Formatters ‣ Disadvantages ‣ If you need style, you need style. You still have to theme. BADCamp, 2011, Tim Cosgrove
  • 189. Modern Theming Field Formatters ‣ Disadvantages ‣ If you need style, you need style. You still have to theme. ‣ Code level required may be daunting. BADCamp, 2011, Tim Cosgrove
  • 191. Modern Theming SASS BADCamp, 2011, Tim Cosgrove
  • 192. Modern Theming SASS ‣ Syntactically Awesome Style Sheets BADCamp, 2011, Tim Cosgrove
  • 193. Modern Theming SASS ‣ Syntactically Awesome Style Sheets ‣ A Ruby project, but there is a PHP port of it and a Drupal module BADCamp, 2011, Tim Cosgrove
  • 194. Modern Theming SASS ‣ Syntactically Awesome Style Sheets ‣ A Ruby project, but there is a PHP port of it and a Drupal module ‣ Greatly enhanced syntax for writing stylesheets BADCamp, 2011, Tim Cosgrove
  • 195. Modern Theming SASS ‣ Syntactically Awesome Style Sheets ‣ A Ruby project, but there is a PHP port of it and a Drupal module ‣ Greatly enhanced syntax for writing stylesheets ‣ Allows variables and ‘mixins’ BADCamp, 2011, Tim Cosgrove
  • 196. Modern Theming SASS ‣ Syntactically Awesome Style Sheets ‣ A Ruby project, but there is a PHP port of it and a Drupal module ‣ Greatly enhanced syntax for writing stylesheets ‣ Allows variables and ‘mixins’ ‣ Allows nesting BADCamp, 2011, Tim Cosgrove
  • 197. Modern Theming Why use SASS? BADCamp, 2011, Tim Cosgrove
  • 198. Modern Theming Why use SASS? ‣ It is incredibly faster than writing CSS. BADCamp, 2011, Tim Cosgrove
  • 199. Modern Theming Why use SASS? ‣ It is incredibly faster than writing CSS. ‣ Your loved ones miss you, and you are wasting your life writing CSS. BADCamp, 2011, Tim Cosgrove
  • 200. Modern Theming Why use SASS? ‣ It is incredibly faster than writing CSS. ‣ Your loved ones miss you, and you are wasting your life writing CSS. BADCamp, 2011, Tim Cosgrove
  • 201. Modern Theming Why use SASS? ‣ It is incredibly faster than writing CSS. ‣ Your loved ones miss you, and you are wasting your life writing CSS. BADCamp, 2011, Tim Cosgrove
  • 202. Modern Theming Why use SASS? ‣ It is incredibly faster than writing CSS. ‣ Your loved ones miss you, and you are wasting your life writing CSS. BADCamp, 2011, Tim Cosgrove
  • 203. Modern Theming SASS Syntax: Nesting SASS CSS .my-selector { .my-selector { padding-top: 10px; padding-top: 10px; } ul { .my-selector ul { overflow: hidden; overflow: hidden; } li { .my-selector ul li { float: left; float: left; margin-right: 10px; margin-right: 10px; } } .my-selector ul li.last { li.last { margin-right: 0; } margin-right: 0; } } } BADCamp, 2011, Tim Cosgrove
  • 204. Modern Theming SASS Syntax: Nesting SASS CSS .my-selector, .my-selector-2 { .my-selector, .my-selector-2 { padding-top: 10px; padding-top: 10px; } ul, ol { .my-selector ol, .my-selector ul, overflow: hidden; .my-selector-2 ol, li { .my-selector-2 ul { overflow: hidden; } float: left; .my-selector ol li, .my-selector ul li, margin-right: 10px; .my-selector-2 ol li, } .my-selector-2 ul li { float: left; li.last { margin-right: 10px; } margin-right: 0; .my-selector ol li.last, .my-selector ul li.last, } .my-selector-2 ol li.last, } .my-selector-2 ul li.last { margin-right: 0; } } BADCamp, 2011, Tim Cosgrove
  • 205. SASS Syntax: Nesting SASS CSS .ie8, .ie7, .ie6 { .ie6 .primary-nav, .primary-nav { .ie7 .primary-nav, float: left; .ie8 .primary-nav { ul.menu li { float: left; } background-image: url(nav_bg.png); background-position: 50%; .ie6 .primary-nav ul.menu li, :hover { .ie7 .primary-nav ul.menu li, background-image: url(nav_bg_active.png); .ie8 .primary-nav ul.menu li { } background-image: url(nav_bg.png); li { background-position: 50%; background-image: none; :hover { hover-background-image: url(nav_bg_active.png); } background-image: none; } .ie6 .primary-nav ul.menu li li, } .ie7 .primary-nav ul.menu li li, } .ie8 .primary-nav ul.menu li li { } background-image: none; } hover-background-image: none; } BADCamp, 2011, Tim Cosgrove
  • 206. Modern Theming SASS Syntax: Variables SASS CSS $standard-border: 1px solid #ededed; h2 { $standard-link-color: #138BBA; border: 1px solid #ededed; $header-font-family: 'Avenir LT W02 85 font-family: 'Avenir LT W02 85 Heavy', Heavy', verdana, sans-serif; verdana, sans-serif; } h2 a { h2 { color: #138bba; } border: $standard-border; font-family: $header-font-family; a{ color: $standard-link-color; } } BADCamp, 2011, Tim Cosgrove
  • 207. Modern Theming SASS Syntax: Mixins BADCamp, 2011, Tim Cosgrove
  • 208. Modern Theming SASS Syntax: Mixins SASS /* border-radius */ @mixin border-radius($values) { -webkit-border-radius: $values; -moz-border-radius: $values; border-radius: $values; } BADCamp, 2011, Tim Cosgrove
  • 209. Modern Theming SASS Syntax: Mixins SASS /* border-radius */ @mixin border-radius($values) { -webkit-border-radius: $values; -moz-border-radius: $values; border-radius: $values; } @mixin basic-gradient($color1, $color2) { background-color: $color2; filter: progid:DXImageTransform.Microsoft.gradient (startColorstr=$color1, endColorstr= $color2); /* for IE */ background: -webkit-gradient(linear, left top, left bottom, from($color1), to($color2)); / * for webkit browsers */ background: -moz-linear-gradient(top, $color1, $color2); /* for firefox 3.6+ */ } BADCamp, 2011, Tim Cosgrove
  • 210. Modern Theming SASS Syntax: Mixins SASS @mixin standard-button { /* border-radius */ @mixin border-radius($values) { @include basic-gradient(#33a8d6, #0092cc); -webkit-border-radius: $values; @include border-radius(200px); -moz-border-radius: $values; } border-radius: $values; } .my-button { @include standard-button; @mixin basic-gradient($color1, $color2) { } background-color: $color2; filter: progid:DXImageTransform.Microsoft.gradient (startColorstr=$color1, endColorstr= $color2); /* for IE */ background: -webkit-gradient(linear, left top, left bottom, from($color1), to($color2)); / * for webkit browsers */ background: -moz-linear-gradient(top, $color1, $color2); /* for firefox 3.6+ */ } BADCamp, 2011, Tim Cosgrove
  • 211. Modern Theming SASS Syntax: Mixins CSS /* border-radius */ .my-button { background-color: #0092cc; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr= #33a8d6, endColorstr= #0092cc); /* for IE */ background: -webkit-gradient(linear, left top, left bottom, from(#33a8d6), to(#0092cc)); /* for webkit browsers */ background: -moz-linear-gradient(top, #33a8d6, #0092cc); /* for firefox 3.6+ */ -webkit-border-radius: 200px; -moz-border-radius: 200px; border-radius: 200px; } BADCamp, 2011, Tim Cosgrove
  • 212. Modern Theming More about SASS BADCamp, 2011, Tim Cosgrove
  • 213. Modern Theming More about SASS ‣ Fully CSS compatible (with SASS 3.0 syntax) BADCamp, 2011, Tim Cosgrove
  • 214. Modern Theming More about SASS ‣ Fully CSS compatible (with SASS 3.0 syntax) ‣ You can drop in existing style, or make an existing stylesheet SASSy BADCamp, 2011, Tim Cosgrove
  • 215. Modern Theming More about SASS ‣ Fully CSS compatible (with SASS 3.0 syntax) ‣ You can drop in existing style, or make an existing stylesheet SASSy ‣ Drupal module aggregates the resulting CSS BADCamp, 2011, Tim Cosgrove
  • 216. Modern Theming More about SASS ‣ Fully CSS compatible (with SASS 3.0 syntax) ‣ You can drop in existing style, or make an existing stylesheet SASSy ‣ Drupal module aggregates the resulting CSS ‣ It’s super-fun BADCamp, 2011, Tim Cosgrove
  • 217. Modern Theming Fieldgroups (field_group) BADCamp, 2011, Tim Cosgrove
  • 218. Modern Theming Fieldgroups (field_group) ‣ Used to be part of CCK; now a separate contrib module BADCamp, 2011, Tim Cosgrove
  • 219. Modern Theming Fieldgroups (field_group) ‣ Used to be part of CCK; now a separate contrib module ‣ Used to create fieldsets, divs, or other containers around groups of field output BADCamp, 2011, Tim Cosgrove
  • 220. Modern Theming Fieldgroups (field_group) ‣ Used to be part of CCK; now a separate contrib module ‣ Used to create fieldsets, divs, or other containers around groups of field output ‣ Extensible BADCamp, 2011, Tim Cosgrove
  • 221. Modern Theming Fieldgroups (field_group) ‣ Used to be part of CCK; now a separate contrib module ‣ Used to create fieldsets, divs, or other containers around groups of field output ‣ Extensible ‣ Can be used to create grid layouts BADCamp, 2011, Tim Cosgrove
  • 222. Modern Theming Example: simple column BADCamp, 2011, Tim Cosgrove
  • 223. Modern Theming Example: simple column BADCamp, 2011, Tim Cosgrove
  • 224. Modern Theming Example: simple column BADCamp, 2011, Tim Cosgrove
  • 225. Modern Theming Solution: div with grid classes BADCamp, 2011, Tim Cosgrove
  • 226. Modern Theming Solution: div with grid classes BADCamp, 2011, Tim Cosgrove
  • 227. Modern Theming Solution: div with grid classes BADCamp, 2011, Tim Cosgrove
  • 228. Modern Theming Custom Fieldgroups Fieldgroups are CTools Exportables, so they are (somewhat) easy to write. BADCamp, 2011, Tim Cosgrove
  • 229. Modern Theming Custom Fieldgroups Fieldgroups are CTools Exportables, so they are (somewhat) easy to write. BADCamp, 2011, Tim Cosgrove
  • 230. Modern Theming Custom Fieldgroups Fieldgroups are CTools Exportables, so they are (somewhat) easy to write. BADCamp, 2011, Tim Cosgrove
  • 231.
  • 232.
  • 233. Modern Theming Fieldgroups on admin forms BADCamp, 2011, Tim Cosgrove
  • 234. Modern Theming Fieldgroups on admin forms BADCamp, 2011, Tim Cosgrove
  • 235. Modern Theming Fieldgroups on admin forms BADCamp, 2011, Tim Cosgrove
  • 236. Modern Theming BEANs BADCamp, 2011, Tim Cosgrove
  • 237. Modern Theming BEANs ‣ BEANs - Bean Entities Aren’t Nodes BADCamp, 2011, Tim Cosgrove
  • 238. Modern Theming BEANs ‣ BEANs - Bean Entities Aren’t Nodes ‣ Fieldable entities that are exposed to Drupal’s block system BADCamp, 2011, Tim Cosgrove
  • 239. Modern Theming BEANs ‣ BEANs - Bean Entities Aren’t Nodes ‣ Fieldable entities that are exposed to Drupal’s block system ‣ Can make any number of BEAN types which can be re-used BADCamp, 2011, Tim Cosgrove
  • 240. Modern Theming BEANs ‣ BEANs - Bean Entities Aren’t Nodes ‣ Fieldable entities that are exposed to Drupal’s block system ‣ Can make any number of BEAN types which can be re-used ‣ View modes apply to BEANs, like any entity BADCamp, 2011, Tim Cosgrove
  • 241. Modern Theming BEANs: Advantages BADCamp, 2011, Tim Cosgrove
  • 242. Modern Theming BEANs: Advantages ‣ Fieldable; build a block out of existing fields BADCamp, 2011, Tim Cosgrove
  • 243. Modern Theming BEANs: Advantages ‣ Fieldable; build a block out of existing fields ‣ Permissions per BEAN type and per field, like nodes BADCamp, 2011, Tim Cosgrove
  • 244. Modern Theming BEANs: Advantages ‣ Fieldable; build a block out of existing fields ‣ Permissions per BEAN type and per field, like nodes ‣ Admin is familiar to users BADCamp, 2011, Tim Cosgrove
  • 245. Modern Theming BEANs: Advantages ‣ Fieldable; build a block out of existing fields ‣ Permissions per BEAN type and per field, like nodes ‣ Admin is familiar to users ‣ Use of the blocks is familiar to site builders. BADCamp, 2011, Tim Cosgrove
  • 246. Modern Theming Example: Image & Text BADCamp, 2011, Tim Cosgrove
  • 247. Modern Theming Example: Image & Text ‣ Label for admin use BADCamp, 2011, Tim Cosgrove
  • 248. Modern Theming Example: Image & Text ‣ Label for admin use ‣ Title for display BADCamp, 2011, Tim Cosgrove
  • 249. Modern Theming Example: Image & Text ‣ Label for admin use ‣ Title for display ‣ Media field for image BADCamp, 2011, Tim Cosgrove
  • 250. Modern Theming Example: Image & Text ‣ Label for admin use ‣ Title for display ‣ Media field for image ‣ User can choose an image style BADCamp, 2011, Tim Cosgrove
  • 251. Modern Theming Example: Image & Text ‣ Label for admin use ‣ Title for display ‣ Media field for image ‣ User can choose an image style ‣ Optional Text BADCamp, 2011, Tim Cosgrove
  • 252.
  • 253.
  • 254. Modern Theming Blockreference BADCamp, 2011, Tim Cosgrove
  • 255. Modern Theming Blockreference ‣ Like Node Reference for blocks BADCamp, 2011, Tim Cosgrove
  • 256. Modern Theming Blockreference ‣ Like Node Reference for blocks ‣ Allows you to pull rendered blocks into a field context BADCamp, 2011, Tim Cosgrove
  • 257. Modern Theming Blockreference ‣ Like Node Reference for blocks ‣ Allows you to pull rendered blocks into a field context ‣ All benefits of fields BADCamp, 2011, Tim Cosgrove
  • 258. Modern Theming Blockreference ‣ Like Node Reference for blocks ‣ Allows you to pull rendered blocks into a field context ‣ All benefits of fields ‣ Reorderable BADCamp, 2011, Tim Cosgrove
  • 259. Modern Theming Blockreference ‣ Like Node Reference for blocks ‣ Allows you to pull rendered blocks into a field context ‣ All benefits of fields ‣ Reorderable ‣ Rendered blocks get search indexed as part of node BADCamp, 2011, Tim Cosgrove
  • 260. Modern Theming Beans & Blockreference BADCamp, 2011, Tim Cosgrove
  • 261.
  • 262. screenshot of listing block example, with highlights like previous slide
  • 263.
  • 264.
  • 265. Modern Theming Display Suite ‣ Display Suite gives access to many of the things described here: ‣ View Modes ‣ Regions in node content (similar to Field Groups) BADCamp, 2011, Tim Cosgrove
  • 266. Modern Theming Display Suite ‣ More capabilities ‣ Views and Panels integration ‣ Ability to send node content to blocks ‣ Exportables of all this BADCamp, 2011, Tim Cosgrove
  • 267. Modern Theming Display Suite Excellent screencasts at http://bit.ly/ds-d7 BADCamp, 2011, Tim Cosgrove
  • 268. Modern Theming Questions? BADCamp, 2011, Tim Cosgrove
  • 269. Modern Theming Resources ‣ BEAN http://drupal.org/project/bean ‣ Block Reference http://drupal.org/project/blockreference ‣ SASS http://drupal.org/project/bean ‣ Fieldgroup http://drupal.org/project/fieldgroup ‣ Display Suite http://drupal.org/project/ds BADCamp, 2011, Tim Cosgrove

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. Here we have not only block reference fields, but additional text fields to use as headers for the groupings.\n
  46. Here we have not only block reference fields, but additional text fields to use as headers for the groupings.\n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. \n
  104. \n
  105. *** Different node types can share view modes. This means that you can configure nodes with relatively different content to look similarly when those nodes share the same location. Video, Photo gallery, articles, stored documents, may all have very different field content but can be configured to show in a similar manner in a given context.\n
  106. *** Different node types can share view modes. This means that you can configure nodes with relatively different content to look similarly when those nodes share the same location. Video, Photo gallery, articles, stored documents, may all have very different field content but can be configured to show in a similar manner in a given context.\n
  107. *** Different node types can share view modes. This means that you can configure nodes with relatively different content to look similarly when those nodes share the same location. Video, Photo gallery, articles, stored documents, may all have very different field content but can be configured to show in a similar manner in a given context.\n
  108. *** Different node types can share view modes. This means that you can configure nodes with relatively different content to look similarly when those nodes share the same location. Video, Photo gallery, articles, stored documents, may all have very different field content but can be configured to show in a similar manner in a given context.\n
  109. *** Different node types can share view modes. This means that you can configure nodes with relatively different content to look similarly when those nodes share the same location. Video, Photo gallery, articles, stored documents, may all have very different field content but can be configured to show in a similar manner in a given context.\n
  110. View modes can be used to render nodes in very different contexts. Views, node references, beans, and programmatic display of nodes can all use view modes. This means that you always know how your node is going to render; you don't need to keep redefining it.\n
  111. View modes can be used to render nodes in very different contexts. Views, node references, beans, and programmatic display of nodes can all use view modes. This means that you always know how your node is going to render; you don't need to keep redefining it.\n
  112. View modes can be used to render nodes in very different contexts. Views, node references, beans, and programmatic display of nodes can all use view modes. This means that you always know how your node is going to render; you don't need to keep redefining it.\n
  113. View modes can be used to render nodes in very different contexts. Views, node references, beans, and programmatic display of nodes can all use view modes. This means that you always know how your node is going to render; you don't need to keep redefining it.\n
  114. View modes can be used to render nodes in very different contexts. Views, node references, beans, and programmatic display of nodes can all use view modes. This means that you always know how your node is going to render; you don't need to keep redefining it.\n
  115. \n
  116. \n
  117. \n
  118. \n
  119. \n
  120. \n
  121. \n
  122. \n
  123. \n
  124. \n
  125. \n
  126. \n
  127. \n
  128. \n
  129. \n
  130. \n
  131. \n
  132. \n
  133. \n
  134. \n
  135. \n
  136. \n
  137. \n
  138. \n
  139. \n
  140. \n
  141. \n
  142. \n
  143. \n
  144. \n
  145. \n
  146. \n
  147. \n
  148. \n
  149. \n
  150. \n
  151. \n
  152. \n
  153. \n
  154. \n
  155. \n
  156. \n
  157. \n
  158. \n
  159. \n
  160. \n
  161. \n
  162. \n
  163. \n
  164. \n
  165. \n
  166. \n
  167. \n
  168. \n
  169. \n
  170. \n
  171. \n
  172. \n
  173. \n
  174. \n
  175. \n
  176. \n
  177. \n
  178. \n
  179. \n
  180. \n
  181. \n
  182. \n
  183. \n
  184. \n
  185. \n
  186. \n
  187. \n
  188. \n
  189. \n
  190. \n
  191. \n
  192. \n
  193. \n
  194. \n
  195. \n
  196. \n
  197. \n
  198. \n
  199. \n
  200. \n
  201. \n
  202. \n
  203. \n
  204. \n
  205. \n
  206. \n
  207. \n
  208. \n
  209. \n
  210. \n
  211. Here we have not only block reference fields, but additional text fields to use as headers for the groupings.\n
  212. \n
  213. \n
  214. \n
  215. \n
  216. \n
  217. \n
  218. \n