Drupal/C2/User-group-and-Entity-Reference/English-timed

From Script | Spoken-Tutorial
Revision as of 19:14, 6 September 2016 by Sandhya.np14 (Talk | contribs)

Jump to: navigation, search
Time
Narration
00:01 Welcome to the spoken tutorial on User Group and Entity Reference.
00:06 In this tutorial, we will learn to:
  • Create User Group Content type
00:11
  • Add User Group fields and
  • Connect Content types with Entity reference.
00:18 To record this tutorial, I am using:
  • Ubuntu Operating System
  • Drupal 8 and
  • Firefox web browser.
00:27 You can use any web browser as per your choice.
00:32 Let us recall the Events Content type we created in the previous tutorial.
00:38 We had created the first five fields shown here.
00:42 To create the Event Sponsor field, we need to create the 'User Groups' Content type.
00:48 User Groups are a group of people who come together to organize an event.
00:54 Examples could be- Cincinnati User group, Drupal Mumbai group, Bangalore Drupal group etc.
01:03 Let us first design the User Groups on a paper.
01:07 A group can have a website, a contact person, their email and their experience level.
01:15 Drupal has default fields for URL and Email, so we have chosen these field types.
01:23 A person’s name can be captured by a Name field. But we will use Text (plain) for now.
01:31 User experience levels can be one of "Beginner, Intermediate" or "Advanced".
01:39 To implement this, we will choose a "List (text)" Field Type.
01:45 The last field here is for capturing all the events sponsored by this group.
01:51 For this, we can use Entity reference field to link to an existing Events Content type.
02:01 Let's set up 'User Groups' Content type.
02:05 Click Add content type. Let’s name this one as "User Groups".
02:11 Notice that the Machine name is user underscore groups.
02:16 In the Description, type: "This is where we track the Drupal groups from around the world".
02:23 In the Title field label, we will name this as "User Group Name".
02:29 Let's set this up in the same manner as our Events Content type.
02:35 Click on Publishing options tab.
02:38 Under Default options, let’s check the boxes for-
  • Create new revision
  • Published and
  • Promoted to front page.
02:48 Now, click on Display settings tab.
02:52 Then uncheck the box for Display author and date information.
02:58 Lastly, click on Menu settings tab and uncheck the box for Main navigation.
03:05 Once we have got that set, we can click on Save and manage fields button at the bottom.
03:13 We are redirected to Manage fields page.
03:17 Here, let's change the Label for the Body.
03:21 Click on the Edit button under the Operations column.
03:26 In the Label field, let’s type: "User Group Description" and then click on the Save settings button at the bottom.
03:36 We can see the green success message at the top.
03:40 For this Content type, we are only going to set up 5 fields.
03:46 We have already created one field. Let's now create another one.
03:52 Click Add field button.
03:55 In this case, we will click on Re-use an existing field drop-down.
04:02 Notice that Link: field_event_ website field is available.
04:08 Because we already named it as Event website.
04:13 Re-using a field allows us to re-use a table in the Drupal database.
04:20 This is done by maintaining different settings for the same field.
04:25 In this case, it makes more sense to set up a new field.
04:30 In Add a new field drop-down, choose the "Link" field type.
04:35 In Label, type "Group Website".
04:39 Click Save and continue and then click Save field settings.
04:45 This time, we will select External links only, since no User Groups actually has a page in "Drupalville" yet.
04:54 Click Save settings button at the bottom.
04:57 Once again, click on Add field.
05:01 This time, we will use a Text field for the contact person’s name.
05:07 Click on Add a new field drop-down and choose the field type "Text (plain)".
05:14 We will name the Label as "Group Contact".
05:18 Click Save and continue and then Save field settings.
05:24 Then click on the Save settings button at the bottom.
05:28 Once more, click on Add field button. This time, let’s choose the "Email" field in the drop-down.
05:37 We will name the Label as "Contact Email". Click on Save and continue button.
05:44 In Allowed number of values, we need only 1. Click on Save field settings.
05:52 There are no other settings here. So, we will click on Save settings button at the bottom.
05:59 Once more, click on Add field button.
06:03 This time, in the Field type drop-down, select the "List (text)" option.
06:09 In the Label field, we will type "Group Experience" and then click Save and continue button.
06:16 One of the things about this Field type that should be kept in mind, is given in this message.
06:23 "These settings impact the way the data is stored in the database and cannot be changed once data has been created".
06:32 This is one of the reasons we emphasize planning.
06:37 Let’s add our values here - "Beginner, Intermediate, Advanced" and "Expert".
06:44 Our User Group could very easily have more than one of these values applicable to them.
06:51 Change Allowed number of values from Limited to Unlimited and then click Save field settings.
07:01 Now, click Save settings.
07:04 We have one more field to add here, that is the Entity reference field.
07:10 Now we learn about what is Entity Reference and how to create it.
07:17 One of the things we want to do in our website is to say that - Events can be sponsored by User Groups and User Groups can sponsor Events.
07:28 This is a very common thing in a website where you want to link two different contents together.
07:35 Events are sponsored by User Groups. So, we want to have the User Group information to be available to every event.
07:45 Now, let’s set this up. Click on Add field.
07:49 If you are a database person, you will recognize these as a many to many relationship within the data.
07:57 Click on Add a new field drop-down. This time, choose Content under Reference.
08:04 In the Label field, we will type "Events Sponsored" and then click Save and continue button.
08:12 Next, we are asked to choose the Type of item to reference.
08:17 You can see there are a lot of options here.
08:21 We are going to keep it very simple - choose Content.
08:26 In Allowed number of values, let’s choose Unlimited.
08:31 Then click Save field settings.
08:34 Here, on the Settings page, we get to choose which Content types are referenced by the User Groups.
08:42 We are referencing 'Events' Content type.
08:46 Here, when I am adding an event, only the events will show up when I start typing the Events title.
08:55 Hence, we need to make sure that we have selected the right Content Type here.
09:01 Choose Events and click Save settings.
09:05 Now, we need to do the same thing in our Events Content type.
09:10 Click on Structure. Then click on Content types here, in the bread crumbs.
09:16 Then for the Events Content type, select Manage fields.
09:21 Let's add one more field. Under Add a new field drop-down, choose Content.
09:28 In the Label field, type: "Event Sponsors".
09:32 Click Save and continue
09:34 Change Allowed number of values; let’s choose Unlimited.
09:39 This is because more than one User Group could sponsor an event. Now, click on Save field settings.
09:48 This time, under REFERENCE TYPE, choose User groups.
09:53 Again, this is because we are referencing User Groups for the Events Sponsors field.
09:59 Click Save settings.
10:01 Now, this links those two Content Types together in a many to many relationship.
10:08 These are based on events sponsors and what Events are being sponsored by what User Groups.
10:16 With this, we come to the end of this tutorial. Let us summarize.
10:22 In this tutorial, we have learnt to:
  • Create User Group Content type
10:28
  • Add User Group fields and
  • Connect Content types with Entity reference.
10:40 This video is adapted from Acquia and OSTraining and revised by Spoken Tutorial Project, IIT Bombay.
10:51 The video at this link summarizes the Spoken Tutorial project. Please download and watch it.
10:58 The Spoken Tutorial Project team conducts workshops and gives certificates. For more details, please write to us.
11:07 Spoken Tutorial Project is funded by
  • NMEICT, Ministry of Human Resource Development and
  • NVLI, Ministry of Culture, Government of India.
11:21 This is Gautam Narayanan, signing off. Thanks for joining.

Contributors and Content Editors

PoojaMoolya, Pratik kamble, Sandhya.np14