How to get your external data into Drupal John Hume Drupal.org: - - PowerPoint PPT Presentation

how to get your external data into drupal
SMART_READER_LITE
LIVE PREVIEW

How to get your external data into Drupal John Hume Drupal.org: - - PowerPoint PPT Presentation

How to get your external data into Drupal John Hume Drupal.org: @littledynamo Twitter: @littledynamo1 DrupalCamp Scotland 2014 What is the Feeds module? Import or aggregate data as nodes, users, taxonomy terms or simple database


slide-1
SLIDE 1

DrupalCamp Scotland 2014

How to get your external data into Drupal

John Hume

Drupal.org: @littledynamo Twitter: @littledynamo1

slide-2
SLIDE 2

What is the Feeds module?

“Import or aggregate data as nodes, users, taxonomy terms or simple database records.”

drupal.org/project/feeds

Basically … Feeds allows you to import external data into Drupal

slide-3
SLIDE 3

A bit of history …

Released in 2009 by DevelopmentSeed

Part of Managing News distribution Written by Frank Febbraro @febbraro Maintained by Chris Leppanen @twistor

Successor of Feed API and Feed Mapper Currently in Alpha – but don’t let that put you off!

slide-4
SLIDE 4

FeedsS

slide-5
SLIDE 5

Case Study – Career Timeline

slide-6
SLIDE 6

Case Study – Career Timeline

  • Timeline event content type
  • Over 600 nodes to be created
  • Data held in multiple spreadsheets

Feeds to the Rescue 

slide-7
SLIDE 7

TheFetcher

slide-8
SLIDE 8

The Parser

slide-9
SLIDE 9

The Processor

slide-10
SLIDE 10

Feeds Importer

Fetcher Parser Processor

Mapping

Feeds Anatomy

Basic Settings

slide-11
SLIDE 11

Fetchers

Out of the Box Contributed

File Upload HTTP PubSubHubbub Callback Directory Oauth HTTP Advanced Authentication Clients SOAP OAI-PMH Mailhandler LDAP SQL Web Services Client HTTP Append Headers FileMaker

slide-12
SLIDE 12

Parsers

Out of the Box Contributed

RSS / Atom CSV OPML XPath iCal Flickr YouTube Vimeo LDAP FileMaker Slideshare Clients Regex Wordpress SharePoint LOTS MORE! XML Sitemap Simplepie

slide-13
SLIDE 13

Processors

Out of the Box Contributed

Node User Taxonomy term Feed Node Data Comment Commerce product RedHen Node (Unique) Self node User contacts Node Multisource

slide-14
SLIDE 14

CSV Import Demo

  • 1. Create content type
  • 2. Create CSV file
  • 3. Add basic settings
  • 4. Setup Fetcher, Parser and Processor
  • 5. Add mapping
  • 6. Import
slide-15
SLIDE 15

Feeds Tamper

drupal.org/project/feeds_tamper

Provides a UI for modifying data before it gets saved

Examples:

  • Replace every instance of 'dog' with 'cat'.
  • Combine separate 'firstname' and 'lastname' fields into
  • ne 'name' field.
  • Break a comma separated list of words into Taxonomy

terms or a multivalued text field.

slide-16
SLIDE 16

Source: http://ygerasimov.com/feeds-cheatsheet-for-developers

Customising Feeds – Program Flow

slide-17
SLIDE 17

Customising Feeds - Hooks

Source: http://drupalcontrib.org/api/drupal/contributions!feeds!feeds.api.php/7

slide-18
SLIDE 18

Source: http://ygerasimov.com/feeds-cheatsheet-for-developers

Before Import

slide-19
SLIDE 19

Source: http://ygerasimov.com/feeds-cheatsheet-for-developers

After Parse

slide-20
SLIDE 20

Source: http://ygerasimov.com/feeds-cheatsheet-for-developers

Presave

slide-21
SLIDE 21

Source: http://ygerasimov.com/feeds-cheatsheet-for-developers

After Import

slide-22
SLIDE 22

Feeds Hook Demo hook_feeds_after_parse()

slide-23
SLIDE 23

Custom Plugins!

Create your own Fetcher / Parser / Processor

  • Declare and Implement a Ctools plugin
  • Extend FeedsFetcher, FeedsParser,

FeedsProcessor

  • If similar plugin exists, extend that class instead
slide-24
SLIDE 24

Case Study – Staff Import from

Staff Database stored in FileMaker Old D6 Custom Module Increasing requirement for FileMaker => Drupal Custom Fetcher and Parser

slide-25
SLIDE 25

Case Study – Staff Import from

feeds_filemaker_feeds_plugins() configForm(), sourceForm() - Settings getRaw()– retrieve the data from FileMaker parse()- normalise the data FeedsNodeProcessor does it’s thing

slide-26
SLIDE 26

Resources

  • List of Feeds contributed Fetchers, Parsers,

Processors and Mappers - https://drupal.org/node/856644

  • Feeds cheat sheet for developers -

http://ygerasimov.com/feeds-cheatsheet-for- developers

  • Developers guide to feeds -

https://drupal.org/node/622700

slide-27
SLIDE 27

Image Credits

  • Speedy Boy Delivery -

https://www.flickr.com/photos/42424413@N06/5 954193181/

  • Lego Chef -

https://www.flickr.com/photos/dunechaser/16150 9118

  • Storm Troopers -

https://www.flickr.com/photos/st3f4n/444814037 7

slide-28
SLIDE 28