DrupalCon Portland 2013

Importa tus datos en Drupal mediante el módulo Feeds

Janez Urevc  · 


HTML (pincha para descargar)



Extracto de la transcripción automática del vídeo realizada por YouTube.

lets you know first few things about me i am drupal developer I come from Europe from Slovenia it's a tiny little country near to Italy where the red dot is it's I live in a seaside I'm currently working for examiner com before that I was a google

Summer of Code student and mentor both with Drupal and I used to work with biggest media company in my country where we migrated websites from their custom CMS to Drupal Sophie's feeds is a very powerful module you can also call it the framework because

it basically gives you tools that you need to get your data into Drupal website it's very pluggable and flexible so we can stick it to almost any use case that has to do with fetching data from a third party source and importing it into Drupal website

it can import the data or feeds from various of various former types you can import XML files you can abort things from HTML pages you can port RSS feeds you can import from csv and when you get data into feeds you can modify it a bit and then save it as nodes

or users or text on me terms you have contributed it integrates fields with drupal commerce so you can import products things like that this is the project page it's very easy to find just go to the drupal org slash project / feeds and if you follow the

link for documentation you can also find the of all contributes that extend fees so it's really a place where you start download it and if you find that your use case doesn't fit into plugins that come by default go to documentation check if there

is a contribute that does what you need this session will be based on demos demos are intended to show you what is possible what can you do and to get a basic idea how it functions ok first demo is a simple case where you build a website and you have a customer

that has a lot of employees and they want you to create a lot of user accounts they send you a CSV file and because there are like hundreds of users in there you don't want to import anything everything manually let's have a look at the CSV it's

very simple we have a header row first row is user so I mean first column is user second column our emails and third column are desired passwords that use these users want to use them for their login okay first let's go to module page we already downloaded

feeds and we search for it and we enable it here and we also need to enable admin UI for fees because otherwise will not be able to configure fees when we enable these two modules we get a new menu item under structure part of the menu which is called feeds

importers you can see it up there when we click on this link we come to page where we'll find list of all feed importers that we have on our website so right now we had an empty page so there were none and later we'll see that the one that we will

create will appear there we click the link to add the new importer and we were redirected to this site where we enter a name for our importer and the description that will describe what this supporter about and now we are at the feed configuration page so

you can see here that on the left side and left sidebar we have various steps that apply to feed frame of fits workflow kind of we have like few steps on every importing process that will fetch our data load our bars data that was fetched load data into notes

or texana me terms and then save everything as an ordinary drupal object and each of these steps has its own configuration part here at this page at basic settings we see that we can still change name and description and we can decide whether to use a standalone

form for our feeds importer or if you want to connect this importer to a node type usually if we have one feeding porter that will fetch data just from one source it's okay to go to end the long form if you want to use one fit importer for more sources

like we have an order for RSS articles from various websites we can attach this to node type and then create a note for every RSS feed that we want import because we will only upload one CSV file it's good to you stand alone form here and below you also

see that we have a drop-down for periodic import it's possible to configure feeds to go and check if there is any new content on your source on every cron or every one hour two hours and so on here we are the fetcher configuration part fechar will know

how to get your data from the internet or from the local server or as we can see here we also have a file upload fetcher which means that we want to upload our file which is the case in in our users use case because we have a CSV file that we need to upload

we can each feature basically each plug-in has its own configuration and with upload plug-in we can limit file types and find where files should be saved in our system then we have parsers parsers are responsible to get data and recognize what is data all

about so if we have a XML that this txt file basically parser will go and find fields that were interested in and by default we have these for parsing feeds and for our use case is csv parser which is very conveniently there already so with CSV parser we have

just a little of configuration we can define with which is our delimiter character so if we don't have commas we can use semicolons or anything else we can also have CSV files with headers or without them so our CSV file header header because we saw that

first row was kind of names of our columns if you would have CSV file without header we can just name our headers with indexes from 0 and incrementing on we want now we're the last step we have processors and because we want to save our items from csv

to like users we will use user processor which knows how to handle users we can configure whether to update or replace existing users that's handy if we get another CSV where with passwords changed for you for customers user things like that and if we

configure feeds to update it will recognize which users have changed and lonely updated their fields appropriately we can also with this specific case where we have users we can also configure roles so if we want to import these users as a specific role okay

if we were if you want to import user as a specific role we can configure that down low down below at the end of the form we'll just import users or as normal authenticated users and here we've come to the mapping part mapping part is a configuration

where we basically tell feeds which field from source should go to which field on our user entity so we can say that user will be translated to user name of our user entities and because we have a CSV file here we have to enter these source header names manually

with the different sources we can also have predefined and we have only drug drop down as we will see later so we map user user column the user name we map male column to users email address and we will also map pass column to user's password and you can

[ ... ]

Nota: se han omitido las otras 3.415 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.