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: - - 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
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
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!
FeedsS
Case Study – Career Timeline
Case Study – Career Timeline
- Timeline event content type
- Over 600 nodes to be created
- Data held in multiple spreadsheets
Feeds to the Rescue
TheFetcher
The Parser
The Processor
Feeds Importer
Fetcher Parser Processor
Mapping
Feeds Anatomy
Basic Settings
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
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
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
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
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.
Source: http://ygerasimov.com/feeds-cheatsheet-for-developers
Customising Feeds – Program Flow
Customising Feeds - Hooks
Source: http://drupalcontrib.org/api/drupal/contributions!feeds!feeds.api.php/7
Source: http://ygerasimov.com/feeds-cheatsheet-for-developers
Before Import
Source: http://ygerasimov.com/feeds-cheatsheet-for-developers
After Parse
Source: http://ygerasimov.com/feeds-cheatsheet-for-developers
Presave
Source: http://ygerasimov.com/feeds-cheatsheet-for-developers
After Import
Feeds Hook Demo hook_feeds_after_parse()
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
Case Study – Staff Import from
Staff Database stored in FileMaker Old D6 Custom Module Increasing requirement for FileMaker => Drupal Custom Fetcher and Parser
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
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
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 -