Drupal/C2/User-group-and-Entity-Reference/English
Title of Script: User Group and Entity Reference
Keywords: video tutorial, drupal, New revision, label, Entity reference, Database, Impact, Reference, Sponsored, Theoretically, Many to many relationship
|
|
Slide 1:
User Group and Entity Reference |
Welcome to the spoken tutorial on User Group and Entity Reference. |
Slide 2:
Learning Objectives
|
In this tutorial, we will learn to
|
Slide 3:
System requirement
|
To record this tutorial, I am using
You can use any web browser as per your choice. |
Part 1 | |
Time | Narration |
0:05 | Let us recall the Events Content type we created in the previous tutorial.
|
To create the Event Sponsor field, we need to create the User Groups Content type. | |
User Groups are a group of people who come together to organise an event.
| |
Let us first design the User Groups on a paper. | |
A group can have a website, a contact person, their email and their experience level. | |
Drupal has default fields for URL and Email, so we have chosen these field types. | |
A person’s name can be captured by a Name field.
But we will use Text (plain) for now. | |
User experience levels can be one of “Beginner, Intermediate, or Advanced”. | |
To implement this, we will choose a List (text) field type. | |
The last field here is for capturing all the events sponsored by this group. | |
For this, we can use Entity reference field to link to an existing Events Content type. | |
Let's set up User Groups Content type. | |
0:10 | Click Add content type. |
0:14 | Let’s name this one as User Groups. |
0:16 | Notice that the Machine name is user_groups. |
0:27 | In the Description, type -
This is where we track the Drupal groups from around the world. |
0:36 | In the Title field label we will name this as User Group Name. |
0:47 | Let's set this up in the same manner as our Events Content type.
|
0:51 | Under Default options, let’s check the boxes for
|
0:57 | Now click on Display settings tab.
|
1:00 | Lastly, click on Menu settings tab, and uncheck the box for Main navigation. |
1:05 | Once we have got that set, we can click on Save and manage fields button at the bottom. |
1:13 | We are redirected to Manage fields page. |
Here let's change the Label for the Body. | |
Click on the Edit button under the Operations column. | |
In the Label field, let’s type User Group Description and then click on the Save settings button at the bottom. | |
We can see the green success message at the top. | |
1:29 | For this Content type, we are only going to set up 5 fields. |
Part 2 | |
Time | Narration |
0:05 | We have already created one field. Let's now create another one. |
0:08 | Click Add field button. |
0:10 | In this case, we will click on Reuse an existing field dropdown. |
0:14 | Notice that Link: field_event_ website field is available. |
0:18 | Because we already named it as Event website. |
0:22 | Re-using a field allows us to re-use a table in the Drupal database. |
This is done by maintaining different settings for the same field. | |
0:39 | In this case, it makes more sense to set up a new field. |
0:41 | In Add a new field dropdown, choose the Link field type.
|
0:45 | Click Save and continue, and then click Save field settings. |
0:51 | This time we will select External links only, since no User Groups actually has a page in Drupalville yet. |
0:58 | Click Save settings button at the bottom. |
1:01 | Once again, click on Add field.
|
1:07 | Click on Add a new field dropdown and choose the field type Text (plain).
|
1:20 | Click Save and continue, and then Save field settings. |
1:26 | Then click on the Save settings button at the bottom. |
1:30 | Once more, click on Add field button.
|
1:40 | In Allowed number of values, we need only 1.
|
There are no other settings here.
| |
1:47 | Once more, click on Add field button. |
1:51 | This time, in the Field type dropdown, select the List (text) option. |
1 :58 | In the Label field, we will type Group Experience and then click Save and continue button. |
2:07 | One of the things about this Field type that should be kept in mind, is given in this message.
|
2:15 | This is one of the reasons we emphasize planning. |
2:18 | Let’s add our values here - Beginner, Intermediate, Advanced, and Expert. |
2:29 | Our User Group could very easily have more than one of these values applicable to them. |
2:36 | Change Allowed number of values from Limited to Unlimited and then click Save field settings. |
2:40 | Now, click Save settings. |
2:42 | We have one more field to add here, that is the Entity reference field. |
2:48 | Now we learn about what is Entity Reference and how to create it. |
Part 3 | |
Time | Narration |
0:05 | One of the things we want to do in our website, is to say that -
|
0:13 | This is a very common thing in a website where you want to link two different content together. |
0:20 | Events are sponsored by User Groups.
|
0:27 | Now let’s set this up.
|
0:32 | If you are a database person, you will recognize these as a many to many relationship within the data. |
0:38 | Click on Add a new field dropdown.
|
0:52 | Next, we are asked to choose the Type of item to reference.
|
0:58 | We are going to keep it very simple - choose Content.
|
1:07 | Here on the Settings page, we get to choose which Content types are referenced by the User Groups. |
1:15 | We are referencing Events Content type.
|
1:27 | Hence, we need to make sure that we have selected the right Content Type here. |
1:30 | Choose Events and click Save settings |
1:34 | Now, we need to do the same thing in our Events Content type. |
1:39 | Click on Structure.
|
1:51 | Let's add one more field.
|
2:03 | Click Save and continue |
2:05 | Change Allowed number of values, let’s choose Unlimited.
|
2:13 | This time under REFERENCE TYPE, choose User groups.
|
2:21 | Click Save settings. |
2:23 | Now this links those two Content Types together in a many to many relationship.
|
Slide 4:
Summary
|
Let us summarize.
|
Slide 5:
Acknowledgement
|
This video is
|
Slide 6:
Acknowledgement
|
The video at this link summarises the Spoken Tutorial project.
|
Slide 7:
Spoken Tutorial Workshops
|
The Spoken Tutorial Project Team conducts workshops and gives certificates.
|
Slide 8:
Acknowledgement
|
Spoken Tutorial Project is funded by
Government of India. |
This is Gautam Narayanan signing off.
|