How to send mail programmatically in Drupal 8

Sometime we require emails to be sent on certain events e.g. for a blog website or a news site we may need to send email after creating new article or blog or in case of e-commerce site we may need to send  confirmation mail after successful completion of an order. In this article we are going to explore how we can use Mail API in Drupal 8 programmatically for sending emails.

Here we will be looking on how to send the email after successful creation of article.

Sending email in Drupal is a two steps process:

  • Define your email properties (like subject, body, headers, etc.) in an appropriate hook_mail() implementation.
  • Use Mail manager to send email

Step 1:

When we send an email programmatically, we need to specify the module name that implements hook_mail().

Now lets see how do we implement it.



 

This is a simple implementation that defines one template identified as test_message (the $key). The other two function arguments are:

$message: passed by reference, and inside which we add as much boilerplate about our email as we need

$params: an array of extra data that needs to go in the email and that is passed from the mail manager when we try to send the email

This was all about implementation of hook_mail().

Step 2 : Using Mail manager to send email

This will gets triggered every time any Article will be created.

Every time when we will create any Article, we load the Drupal Mail manager service and start setting values for email. We need the following information:

  • $module : the module name that implements hook_mail() and defines our template
  • $key : the template id
  • $to :the recipient email address (the one found on the current user account)
  • $langcode :the language which goes inside the $params array and which will be used to translate the subject message
  • $params['subject'] : email subject
  • $params['message'] the email body
  • $send : the boolean value indicating whether the email should be actually sent

We then pass all these values to the mail() method of the mail manager. The latter is responsible for building the email (calling the right hook_mail() implementation being one aspect of this) and finally delegating the actual delivery to the responsible plugin. By default, this will be PHPMail, which uses the default mail() function that comes with PHP.

And this is all about sending emails programmatically using Drupal 8. We have seen the steps required to send email programmatically by the mail manager whenever we want it. We have also mentioned the default mail delivery plugin which is used to send emails in Drupal 8.

Source : https://github.com/adityaanurag/demoMail.git



 



Advance Your Business: Drupal 8 Support Ends - Take Action!

 

Managing user roles & permission in Drupal 8

One of the reason why Drupal is hugely popular for content management application development, because of customizable content authoring workflow. We can simulate good old editorial experience where authors create the article, sub-editor review it and finally editors will confirm & publish if all organization lead criteria are met. In Drupal we create this permission system by creating roles.

Instead of assigning specific permissions to each user, permissions are assigned to roles. And then specific users are assigned role(s) e.g. author, reviewer, editor.

In this post we will explore how to create roles, specify permission for the role and assign specific role to user.

Step 1: First step is to go to Manage >> People >> Roles. Here you will find three default roles of "Anonymous", "Authenticated", and "Administrator" along with option to  add new roles  by clicking on +Add role.


Anonymous: Site visitors not signed in to your website. Generally they can view the pages of website.
Authenticated: Signed-in site visitors who are registered users on Drupal site.
Administrator: Signed-in administrative "super-users" of site. This role is always assigned every permission for every module which is enabled. Administrators have full access to all available functionality on your site. If we need, we can remove permission for certain functionalities.

user_role_page

Step 2: click on +Add role to add new role, which can be assigned to user. Here I’m creating a role called “Content Manager”.

creating_role

Once the role is added,. it will show up in role listing page.

listing_new_role_in_role_page

Step 3: Now it’s a time to assign our custom role “Content Manager” to the user.
Go to user listing page & edit one of the user.

user_created_with_no_role

On user edit page go to Roles section. check on “Content Manager” and click on save  button.

role_listing_in_user_edit_page

So, we have assign “Content Manager” role to one of the user. and it start listing on user listing page with new role.

user_role_assign_as_content_manager

Permissions:
Site permission let you control what users can do and see on your website. there are Many different functions and features available on Drupal site that can have a  permission that you can enable or disable.Permissions control access to administrative tasks and general website usage such as viewing published content.

permission page

Step 4: Finally, we can configure permissions for Content Manager at Manage >>People >> Permissions tab. To give Content Manager the ability to edit any page within the site, scroll down the permissions page and click the checkbox next to 'edit any' for each content type.

giving_permission_to_content_manager_to_edit_any_content

Now login with new user we just assigned the role of “Content Manager”. You will get edit option for all the basic page like below.  

 content_manager_getting_edit_option_in_node_page

This was one of the simplest role with permission we have added. This can be used as foundation to create organization specific content authoring workflow.

User creation with additional field

We always talk about building a community platform using Drupal. In large website we also need lot of user having different roles and associated permission. In this post we are going to explore how can we add users as well adding fields to user profile page. As a site admin, we have ability to add multiple user at any point of time. We can enable permission to allow anonymous users to create new account in your site.

1. How to create a new user account

Step 1.1: Log in as admin.


Step 1.2: Go to Manage >> People

 admin_toolbar

Step 1.3: Once you click on People link, you will be redirected to user adding page.

user_listing_page

Step 1.4: Click on +Add user for new user.

This page requires user email address, Username, Password, Confirm password, Status,    roles, profile picture, locale settings with contact settings.

Email address: The email address of the user, though not required, highly recommended. This information is kept private.

Username: This will be the username for the member and will appear on the site. Spaces are allowed as well as limited punctuation (.-'_).

Password: The user's password. make sure to use a strong password. combination of special character, lower & upper case with numbers and punctuation. Under that you will need to enter the same password again in the Confirm password field.

Status: This allows you to set a user to either Active status or Blocked, meaning they cannot use the site as a member.

Roles: This allows you to give members different roles. The two default roles are Authenticated User user and Administrator. More than one can be selected for a member.

Profile picture: Upload a user avatar in this section if you wish.

Contact settings: Allow other users to contact you via a personal contact form which keeps your email address hidden.

Locale settings: for selecting time zone.

adding_new_user

Step 1.5: Once we have entered user data, click on the Create new account button at the bottom of the page. Your new member will now appear in the list for all users.

added_new_usernew_user_created

like this an admin can add new user to his own site.

2. How to add custom field to user.


Incase if you wants to add few more field for user registration. you can do with few easy step.

Step 2.1: Go to Manage >> Configuration >> Account settings >> Manage fields and click on +Add field. currently i am adding Date of Birth field to user addition page.

people_field_settinglimit_field

 Step 2.2: Once you have saved field setting. it will start appearing on user page.

people_field_settinguser-account-setting-page

 

As we can see the new field “Date of Birth” is listed on user registration page.

creating_new_account

3. Enable Anonymous user to create new account

Similar to Drupal 7, 8 also has feature related to user account setting. These options are to allows admin to enable registration by either Administrators only, Visitors or Visitors, but administrator approval is required.

Drupal 7 user setting page

drupal-7-account-setting

Drupal 8 User settings page

drupal-8-account-setting

 

Option 1:
To check available option, i am selecting Administration only as a option.
In this case Anonymous user won’t get the option to register into Drupal site while visiting drupal-8/user/login.

drupal-8-only-admin-can-register

Option 2: By selecting visitors, anonymous user will get the option to register on site.

drupal-8enabled-anonymou-user-registration

Option 3: By selecting Visitors, but administrator approval is required will help anonymous user to create an account with blocked status. Once admin has approved the particular account will help user to login to the site.

account_created_require_admin_approval

Once admin has changed the user status from Blocked to Active, application will allow specific user to be login to drupal site.

How to Create a Website with Drupal 8

Drupal 8 has amazing features for everyone that can help you to build any Web site you want to. easier to customize components than never before. Drupal 8 uses Semantic HTML5 helps you to create interactions. You can make content structures easier to understand for people with disabilities.

In last couple of weeks we have covered varioous topics of Drupal 8 site building learning. Below is compiled list of articles which you can use as reference while building your first website.


  1. Setup Drupal 8 in windows with xampp stack package / Installing Drupal with Drush, the Basics - before we begin with Drupal 8 site creation, we need to install Drupal 8 to our local web server.
     
  2. Understanding Block layout in Drupal theme structure - we will go through layouts structure & custom block library and how to assign  basic content blocks in selected region.
     
  3. Changing the Appearance of your new site - we will learn How to install new theme & configure their settings according to the requirement.
     
  4. Using the Content Type to manage content consistently  - Manage Content by Creating custom content type and adding fields to those content type.
     
  5. Manage your articles using Taxonomy in Drupal 8 - we will create a fresh new vocabulary and add terms to those vocabulary. adding those terms to a fresh content.
     
  6. Newly introduced mobile first Menu management in Drupal 8 - create a new menu type with custom links and assign the same menu block to one specific region.
     
  7. Learn how to use views which is part of core module in Drupal 8 - we will learn how can we create view block and view page to showcase specified content type with few fields.
     
  8. Creating Home page and basic pages - How an admin can create a Basic Page and Homepage with few simple steps.
     
  9. Getting Comment on your article - Create an comment type and field to the same and assign those comment to different entity.

Creating Home page and basic pages

Creating a home page or front page in Drupal 8 is quite similar to the way we used to do Drupal 7. By default home page will list out all the nodes in teaser view. We just need to create a new page and schedule it  to display on page or you can also promote other node  to be displayed on home page. However, most of time we would like to have a custom page as our site home page not like listing of teaser view. In this blog post I will explain the process of changing the front page of your new Drupal 8 website.

Step 1 :  Log into your Drupal 8    
Step 2 : select “manage”  menu from the toolbar from   the main menu on the top.

admin_toolbar_menu

Under manage there is option of  “configuration

admin_toolbar_menu_expanded

 

Step 3 : clicking on configuration will redirect you to Home >> Administration
click on “site information” under SYSTEM. Under Front Page provide the Default Front page url & that page would be assigned as home page for our site.

I have assigned node id 4 to display as page.

site_information_setting

After entering the chosen node, click on the Save Configuration. Now when you click the site logo or Home menu link, you should see the newly assigned node as home page.

Default page: when we don’t have any assigned page in our site setting in that case user page of logged in user  itself becomes the front page of your drupal site.

drupal_default_home_page


 

home_page_assign_to_node

Creating a Basic page

Step 1: To add Basic page  go to content >> Add content >> Basic Page

creating_basic_page


Step 2: If you would like to add some additional field on Basic page click on Structure >> Content types >> Basic page >>  Manage fields >> Add field

manage_field

 

Step 3: Let's add one email field for basic page with label “Mail”. For this we need to go to admin >> structure >> types >> manage >> page  >> fields and click on Add field.

mange_field_label

Step 4: Limit the no of values for email field. In this case I am limiting it to 2

 manage_field_no_of_values

Step 5: Next we will change label name, help text, default value etc for the fields we added above.

manage_field_settings

 

Step 6: So now we are done with adding the field,.we can view the field under page manage field tab.

custom_field_displaying

Step 7: Add a new page by visiting https://drupal-8.0.2/node/add/page .
we can see our newly added two mail field with default value. Fill up all the detail and Save and Publish the page.

create_page

Step 8: Once basic page has been submitted you will be redirected to node view page.

page_with_additional_info

We have completed how to assign a specific node to Home page  as well as create a new basic page.

Newly introduced mobile first Menu management in Drupal 8

In this post, we'll continue site building by adding menu items to our newly created Drupal 8 website. We will create custom menu which'll be used to display links, then assigning these links to a page. We will also add a menu link to specific region within the theme for demonstration purpose.

Managing Drupal menu happens within administration sector. To begin, login as an administrator in your website.

Although there are several default menus available in core, we have ability to create custom menu using admin interface. This has to be done in two parts, first is to create structure of the menu and the second is to add links to it.

Step 1: Create a Menu
To create a menu, visit Manage >> Structure >> Menus

structure_listing

In Drupal 8 menu is categorised in 4 sub category

  1. Administration
  2. Footer
  3. main navigation
  4. Tools
  5. User account menu

Administration menu
By visiting admin/structure/menu/manage/admin you can view list of all admin menu including parent child menu on this page

Content, Structure, Appearance, Extends, Configuration, people, reports, Help are part of admin menu.

admin_toolbar

Footer Menu

Visiting admin/structure/menu/manage/footer page will  list out the footer menu items.

footer_menu

Main Navigation Menu:

You can view all main navigation menu items under admin/structure/menu/manage/main .

main_navigation_menu

Tools:

Browse the admin/structure/menu/manage/tools, it will list out shortcut icons available in sidebar block region

toolbar_menu

User account menu:

This will list out user related menu items e.g: My account,  Log out,  profile.

user_account_menu

Step 2: Add Menu Links

In the previous step we have learned about different type of menu available in Drupal core. Now lets create our own a new menu. licking on the +Add menu button. You also have option to create a new menu category by visiting admin/structure/menu and clicking on +Add menu button.

Step 2.1
We are going to create a new menu category and add links to the same. once we filled up Title and summary, click on Save button. This will redirect to add link page.
 

creating_custom_menu

Step 2.2
On admin/structure/menu/manage/. you will find Add link option

adding_menu_link

The page redirect to menu configuration. where we can provide specific title with pointing node id, description, weight. node enabled disabled option.

Step 3: Assign the Menu to a Block
Once the menu is created we can assign this to specific region in our website.
Visit admin/structure/block and click on any of the region where you would like to place the menu block. I am assigning to Secondary menu. Click on place block and search for our new menu block.

placing_block

We can Configure the drupal blocks based on different criteria like:

Content types: This option list out the available content types where we can assign if the block should be displayed or not for selected ones.

visiblity_by_content_type

Pages: In this tab we can configure block visibility based on page url or by node id. We can have add multiple node id, each in new line.

visiblity_by_page

 Roles: Using this option we can decide which role(s) can view this block ?

 this tab will list of roles available in your site. We can check one or more than one roles for visibility setting.

 visiblity_by_role

We can rename the block title as well as have option to enable/ disable them.
Once you have done with all the settings click on save block button.

configuring_block

As I have selected show for the listed page “”. and Region as “sidebar Second”, it will be displayed in front page only.

Now we can review our block in the region.

menu_block_assigning_to_sidebar

From site building perspective, menu UI is similar to what we used to have in Drupal 7 ut from the architectural point of view, the routing system in Drupal 8 has been built using Symfony components. I will be covering this in my future blog post.

Getting Comment on your article

The best way to communicate with online reader is allow them to give feedback or add comment on your article. Comments are great way for communicating with readers and the community. 

The functionality has changed a lot in Drupal 8. In Drupal 7, the comments system was quite simple. You could use them on content types and have only one single comment type. But what about if you want this different comment form for different  content  e.g. sometimes we need user to add feedback with just two fields, name & message and in another content type we need review system where besides name & message, user should rate the article based on some scale. 

To address these limitations, comments system has been rebuilt in Drupal 8. It could be attached to any entity type by adding a "Comments" field. Now you can have multiple comment types. This also help us to differentiate many type  of things like having public /or private comments on a single bundle.

In this Tutorial we are going to explore:

  1. Adding Comment to Content Type
  2. Creating Different comment Types

1. Adding Comment to Content Type

Step 1.1: Go to Manage >> Structure >> content type and select Article content type & click on Manage fields

content_type_list

Step 1.2: Click on +Add field. ou will be redirect to Add field page where you can select comments as new field or you can just Re-use an existing field from your site. 

Add the label name and click on Save and continue.

adding_comment_as_field

Step 1.3: Select comment type from the two option - Default comments and visitor. Click on save field settings.

manage_comment_field

Step 1.4: Add comment setting for Article content type and click on save settings. these settings holds label, help text, required box, Default value (open / closed / hidden), comment per page, comment threading, Preview comment (Disable / Optional / Required). Once you have filled up all the required data click on save settings.

comment_setting

 

Step 1.5: So, we have selected Comment type as “Default comments”. To check the setting for the same go to /admin/structure/comment and click on manage field under “Default comments” type.

comment_type

2. Creating Different comment Type
In the previous section we have enabled comment for our content type. Now we are going to create a new comment type itself to be used with another content type.

Step 2.1: Go to manage >> structure >> Content types >> comment types
and click on +Add comment type.  Fill up label, description, target entity type and click on save.

comment_type_adding

Step 2.2: Once Comment type has been added click on manage fields. Add the choice of field to your comment type. Below I have added Email field.

mange_field_on_custom_comment

Step 2.3: Once you have done with adding up new field go to content type listing page and click on manage fields.

On click of adding comment, you’ll be redirected to comment type selection page, where you can choose your custom comment type and click on save field settings.

custom_comment_listing_in_drop_down

Step 2.4: Next is to configure comment for the content type.

comment_setting

Once you have saved the fields, we can view the same by visiting any article. Your article should have  custom comment type “Article comment” with additional field Email.

custom_comment_with_email_field

Now you should be able to add new comment types with specific fields for different content types of your project.

How to use views in Drupal 8

The most installed module in Drupal “Views” is now available as the core modules of Drupal 8. Now you don’t have to search for the latest version of views separately.

For the 1st timer, Views allows you to generate dynamic query using easy to use UI. That's the simple explanation, but it doesn't give the module the credit it deserves.

For instance, you can create a page (/latest-news) which displays all the latest content by bundle type and sorted by posted date. Using the module, you can display content in a block, table or formatted structure.

In this article, we'll continue building our new site by adding up few more custom views. We'll create a view page to showcase news on homepage, and a "Recent News" block.

So, Let’s Begin with View page creation.

Step 1: Go to Manage >> Structure >> Views >> click on +Add new view

admin_structure_page

 

add_a_view


Step 2: Clicking on +Add new view redirects to “Add new view” page.
The page has View Basic information fieldset that contain View name and Description.

Section 2 has VIEW SETTING which has option to  show, type, and sorted by.
Where, Show means what would you like to Display, Comment, Log entries, Files, Content, Content revision, Taxonomy Terms, Users, Link Count, Custom block revision or Custom block.

Of type holds bundle type either Article, Basic page, custom content type or All.
Sorted by - How do you wants to sort? Sorting by Newest first, Oldest first, or by title; these are the initial level sorting options. Later on you will get more and more sorting criteria e.g.: by author name.

creating_view

The Addition of new view also carries PAGE SETTINGS & BLOCK SETTINGS.
Once you check on “Create a page”, this will open up page configuration section which, includes page title, page path, Display format, item to be displayed, with three additional option.

  • use a pager.
  • create a menu link &
  • include an RSS feed.   
view_page_settings

Checking the block setting Will allow you to create a “view block”. This section has option to update Block title, Block Display settings, items per block with pagination option.

view_block_settings

Once you are done with filling up these fields value. click on save and edit button. i’m creating view page and view block both in in this example.

view_page_with_view_block_info

Step 3: Once you have saved the view page data, page will be redirected to view Display configuration section having page and block UI.

Just like Drupal 7 views contrib module, Drupal 8 views also has similar UI.

As we can see here view has multiple configuration.

Title : set the title for view page.
Format: How data has to be displayed on the site.
Fields: what are  fields you would like to display.
Filter criteria: allow filter by type as well as option to  expose the same.
Sort criteria:  sorting of field date ascending or descending manner.
page Settings: set the page path, assign to menu if required, view permission.
Header: custom header for the view page.
Footer: custom footer for the view page.
No Result Behaviour: In case if view query fetches no data or empty set, we can set option to override and display custom message to user e.g. no search result available, please try again.
Pager: allow site to create pagination on view page.
Advanced: As the label suggest, this section has advanced  options like CONTEXTUAL FILTERS , RELATIONSHIPS, EXPOSED FORM, OTHER etc.         

You can check my previous blog post on how to use contextual filters in Drupal 8 for mode details.

views_contextual_filter

Now, let’s start with view page configuration.

We will add a filter to display only content from news.  

To add a filter go to FILTER CRITERIA section and click on Add button. This will show pop up box, where you can search by Type or search by name. As we are filtering based on content type this can be done in two ways -

  1.  Select Content in Type dropdown and search for Type.
  2.  Write type in Search box and select appropriate.

Select the checkbox next to Type and click on Apply (all displays).
 

view_filter

Once Type is selected, you will be redirected to configuration page where there is option of “Expose this filter to visitors, to allow them to change it”. Under the content types you can select single or multiple bundle selection option and also have Operator. Once you have set the configuration click on Apply (all displays).

views_filter_criteria


Moving to SORT CRITERIA, click on Add button. I am filtering content based on news posted date in Desc order.

  • Under Type drop down select content.
  • Search for Authored on and click on Apply (all displays).
views_sort_criteria

The below page shows configuration for filtering option e.g. Exposing this sorting criteria to the end users, sorting order either ASC or DESC and Granularity.

view_sort_configuration

Next go to PAGE SETTINGS. Here we we can set the page url path.

 

views_page_path

We can set the menu and assign this to specific category. Menu could be either part of admin menu, footer, navigation or tool menu. 

views_menu_page

Access has setting of permission, roles and none. This is helpful if you want to restrict or display specific page view to specific role or add a permission.

views_access_restriction

Once you have selected Role click on settings link. In my case I want to display this page only to Authenticated user. Anonymous user will get the custom configured message. Do not forget to click on Apply button.

views_access_role_option

Moving to “NO RESULTS BEHAVIOR”, select Global from “Type” filter. Check on Text area and Apply (all displays) button. Fill up content data and click on Apply (all displays) again.

views_no_result_behaviour_text_area

Now it’s time to display specific no of content on latest-news page. Go to PAGER >> Full click on settings link. This will redirect us to pager setting page.

views_pager_selection

Pager settings page has item per page, offset, Pager ID, Pager link labels, exposed options etc.

views_pager_option

We can add custom text for first / previous / next / Last page.

views_pager_link_label

There is additional Exposed Option to control selected option

Allow end user to control selected display options for the view.

views_exposed_control_option

Once you have done with view configuration click on save and review the page. Lets check our page now at localhost/drupal-8.0.2/latest-news

views_listing_page

Try changing the content type in views check the page if there is no content available. It would show custom message you have added earlier in views.

As we have restricted this view page for Anonymous user. if you visit you view page without login, you will get Access Denied page.

views_access_denaied_page

So, we are done with Basic Drupal 8 views configuration.


Step 4: Next we will cover Drupal 8 views Block. Go back to our view configuration page and click on Block.
Similar to views page it has all the configuration. I am adding block name as “latest news block” and saving the view.

block_admin_description

Now assign this “latest news block” view block to any region. Visit Manage >> Structure >>  Block layout

I’m assigning my view block to sidebar second. Search for latest news block and click on place block.

place_block

Now it’s time to configure block. configured item per block. visibility based on content type, page roles, and also it’s provide region and views machine name and click on save block.

configure_block

In case block view doesn’t have any data, it should display custom message.

block_listing_with_no_content

Attached is the screenshot for our views block assign to sidebar region to display only on page.

 block_with_content

 

Valuebound takeaway from DrupalConAsia 2016

DrupalCon Asia 2016 is finally over and I doubt all the Drupalers who attended have recovered from the hangover of the event. On the closing ceremony we got a great figure, it was the first DrupalCon for nearly 80% of the total 1025 attenedees, which is astonishing. Even for us, the team from Valuebound, it was the first DrupaCon. So in this blog I am jotting down our own experience and how much fun we had.

Valuebound team kickstarted volunteering from Day 0. How? We just went to see the venue where the DrupalCon Asia will be hosted right after landing in Mumbai, and reaching there we saw bunch of people working for the next day. There we met Rachel Friesen, event manager of Drupal Association, working with a bunch of volunteers. The next moment whole Valuebound team started working with her filling up badges for the attendees. Why? No reason. We just couldn't resist ourselves seeing the enthusiam of other volunteers.

The excitement was so much that we were all ready & geared up, reached the venue by 7:30 AM. Yeah you heard it right. 7:30 in the morning. We wanted to volunteer, we wanted to be a part of the DrupalCon Asia 2016, we wanted to contribute in any way possible. Rachel briefed us about our tasks in the help desk and we took our respective positions.

At around 8:30 people started turning up for the registration. But by 9 there were an array of attendees showing up for registration and in no time empty floor was filled up by a huge clan of Drupalers from different parts of the globe. It was great to see such a colossal crowd assembled together with one thing in mind, Drupal

But this section can't get over without mentioning someone special. You guessed it right. When Dries Buytaert showed up to take his badge, he was sorrounded for a selfie by all the Drupaler for whom he was a superhero. With that a new term was coined by Rachel "Driesie", a selfie with Dries.

2

On the eventful Driesnote the whole auditorium was packed with all the attendees. Prior to the Driesnote there was a special Bollywood style prenote by Jeffrey A. (jam) McGuireAdam Juran and Campbell Vertesi which was concluded by nearly all of the audience converting the stage to dance floor. Prenote was real fun. We are going to remember this for long time.

 

The Driesnote was a proud moment for whole community but there was something special for Valuebound. We were in his slide. As the number one contributor to the Drupal 8 project from India.

 

Following the keynote by Dries, there were the series of session on various topics raging from Backend development to Drupal Community for absolute beginners to experience Drupal ninza. Though it was not possible to attend all of them but we made sure that we make most out of it.

The session on PHP Fig by Jam and Campbell Vertesi was the first one that we attened. Don't worry I am not writing about all the sessions that we attened. This was exclusive for us because of the chat we had with them after their session. They were really impressed by us and our approach of how we have adopted and contributed to Drupal 8. Instead of we asking them about their experience they were more interested in knowing about what we feel about Drupal and how managed to cope with Drupal 8. That was one of the memorable moment for us.

Rest of the day we were attending other sessions, voluteering/monitoring of the sessions, wandering around the booths by all the sponsors who were giving a lot of goodies for the attendees and connecting with the hot shots of the Drupal world.

One of the most intriguing element of such large scale meetups is that we get to connect to so many folks of the community which really makes you feel blessed to be a part of such a huge family. Some met their mentors with whom they were only acquainted via IRC or the virtual world, some met their colleagues from previous organisations, some got to meet their idols who they follow. DrupalCon really opens up the Drupal cosmos which I believe is a real impact for everyone's Drupal journey.

For Valuebound it was a great experience and we realised that we have a great visibility in the Drupal community which which made our determination stronger to take this to the next level, as a Contributor and as an organisation

I know it has been a long blog post but come on, it was DrupalCon Asia. In fact it is just the tip of the iceberg. But a picture is worth a thousans words. Here is an album of the pictures we clicked on our tour to Mumbai and DrupalCon Asia.

DrupalCon Asia 2016

In the conclusion we would like to thank Megan SanickiRachel FriesenAmanda Gonser & many other volunteers and of course Drupal Association for organising DrupalCon Asia which was a dream for whole Indian Drupal Community. Hope to attend more DrupalCons in the coming years.

Manage your articles using Taxonomy in Drupal 8

Taxonomy is one of the features that add lot of advantage to Drupal compared to many other CMSs open source as well as proprietary.

Taxonomy is all about organizing your site by assigning descriptive terms to each piece of content.

While you can organize your content based on content types and creators, you might also want to view content based on what the content is about. Taxonomy allows you to associate terms with your content, which you can use to organize and display content on your site. Each set of taxonomy terms is part of a category set that you define, and is called a vocabulary. Terms in vocabularies that can be further broken down and can contain sub-terms.

In this session we would learn

  1. How to create vocabulary
  2. How to add term to those vocabulary
  3. How to add terms to content type


1. How to create vocabulary
Go to Manage >> Structure >> taxonomy, here by default we have Tags vocabulary.
at this place we can add vocabulary by clicking on +Add Vocabulary

 

Add Vocabulary

Please provide Vocabulary name and short description for new vocabulary and click on Save button.

 

Add Vocab Geners of Books

 

2. How to add term to those vocabulary?

clicking on save button will redirect to term listing page of our new vocabulary. now click on +Add term

 

Adding term

Once you have added all the term, you can view all of them on admin/structure/taxonomy/manage//overview

 

term listing

 

3. How to add terms to content type?
go to Manage >> Structure >> Content types

click on Manage fields for the content type , for whom you would like to add  taxonomy field.
in my case i have selected Article content type.
to add taxonomy click on +Add Field

 

Adding field

 

On settings page add no of term. limited/unlimited value selection from user end

 

Field setting

 

on this page admin can configure settings for taxonomy like label, help text, default value, reference method and choose vocabulary and click on Save settings.

 

content type setting for article

So, we are done with adding new taxonomy term to Article content type. Now we can go to content >> Add content >> Article >> Create Article

 

Create article

 

As we can see our custom taxonomy field “Geners of Books” with widget type autocomplete. you can change the widget type to Autocomplete, Select list from manage form display

Now it’s time to create content and test.
i’m too lazy to create content, so i have used devel to generate multiple nodes for the same content type.

page view

Clicking on Poetry at the bottom will redirect to taxonomy term listing page with specific term
url: drupal-8.0.2/taxonomy/term/14

In above URL replace drupal-8.0.2 with your own folder name or domain name where Drupal is installed.

Download the Drupal Guide
Enter your email address to receive the guide.
get in touch