Ajouter un commentaire
Sitebuilders will be able to do much more with Drupal 8 right out of the box. There are many excellent enhancements you'll want to know more about.
Because new Drupal adopters will have the essential functionality of the most popular contributed modules to use, I think this is going to make Drupal easier to discover and learn. As the manager of our training program here at Acquia, I think it's going to make training much more interesting, too! Content editors will also benefit (See Content editing enhancements in Drupal 8, if you didn't already review that. It covers the main changes in the admin UI, too).
From the point of view of structuring content types - sitebuilders have increased responsibilities. As new applications like Flipboard come along, and new information design trends such "cards", site builders are going to be more and more concerned about how their data will appear and be reused in other contexts, and how relevant their content appears in search engines hungry for structured data. Drupal 8 is way ahead of the game in helping you make the most of your data.
You might be curious about what changes are in store for the sitebuilding experience, so let's start by focusing on the most important tasks you'll undertake: modeling data.
Entities and Fields in Drupal 8
Probably the first changes sitebuilders will notice in Drupal 8 are the changes to content types and fields: the bread and butter of site building in Drupal. However, the field changes affect not only content types, but any entity that can have fields. (Still confused about Entities? Check out this intro to entities on Drupal.org.)
When you go to edit an existing content type, Article, you’ll notice some differences in the tabs. No more comment fields and display tab. And we have a new tab: "Manage form display."
Curious what this means? I'll dig into these changes in this blog post:
- New fields in Drupal 8
- Managing fields in Drupal 8
- Form modes in Drupal 8
- Comment form configuration
- Step-by-step tutorial to add a field in Drupal 8, so you can see some improvements that have been made to the experience
- Getting the most out of your data with Schema.org and RESTful web services
New fields in Drupal 8!
There are new fields available in Drupal 8.
- Datetime (This doesn't include the recurring date functionality from the Date field module. You’ll need to go to contrib modules for that.)
- Entity reference - Link to users, terms, content, etc. with an auto-complete field.
These new modules might be some of the first modules you go to enable. As you do, you’ll notice the new handy module filter.
- Go to Menu > Extend > Filter to search for a specific module.
- The filter works only by name, not the description.
Managing fields in Drupal 8
The experience of creating content types, taxonomy, and new users is going to look very similar to someone coming from Drupal 7. In Drupal 7, on the "manage fields" page, you added fields and arranged how the form appears, and which widgets content editors would use.
In Drupal 8 these two actions had to be separated. Manage fields only controls how the data is modeled; that's where you configure which fields and data types make up your new content type. Here you delete and add fields, and they are listed A-Z.
This change was to make way for form modes.
Form modes in Drupal 8
With Drupal 8 you can have multiple forms for adding content types, taxonomy terms, users and so on.
Go to Administration > Structure > Display modes > Form modes to see the form modes available.
Out of the box, there is one example form mode - this is for the User form, an ideal use case. Say for example you want to lower barriers for membership, and present new users with as few fields as possible on registration: a username and email address. Later, after they join, you'd like to give them the option to edit their full profile and add a picture and configure other settings. In this case you'd have two "form modes" one for registration and one for editing your profile.
- Go to Administration > Configuration > People > Accounts > Manage form display.
- Click to expand "Custom display settings"
- Enable the "Form Register" form mode.
- Then you can move fields to be hidden during registration.
Comment forms in Drupal 8
First let’s just review how things were in Drupal 7. In Drupal 7 you could add fields to comments on specific content types. You couldn’t add comments to things such as users, taxonomy terms or any other entities or bundles.
In Drupal 7, you could disable comments on content types, but an author with the “Administer content” permission could override that setting and enable comments on a Basic page. This was because comments were part of the node entity type. All the comments settings were part of the initial content type configuration.
In Drupal 8 you'll configure Comment forms independent of a specific content type. This means you can have a comment form type for articles, and another for forum replies. Nice! It also means you can reuse a comment form settings and ensure consistency across your site. Comments are added in the same way other fields are, so there isn’t a separate configuration tab for “Comment fields” and “Comment display”.
This also implies that if you don’t add a Comment field to a content type, you can’t just override that per-item. That’s cool!
The comment form settings include:
- Default value: Open, Closed, Hidden.
- Comment form settings: Threads, Comments per page, Allow title, Show reply, Preview settings.
Now that the comment form settings are similar to the settings for any other field, I think this is going to make site building easier to learn in Drupal 8.
Step-by-step tutorial: Add a field
To test out a new field, add an “Email” field to a content type.
- Go to Menu > Structure > Content types > [select content type] > Manage fields.
- Add the email field.
- You’ll notice on the next step where configure global settings for the field, you can now set an arbitrary number of values. In Drupal 7, you could only set 1-10 “limited” and then unlimited. So you can have 15 or 35 as a limited number! Nice move, D8 team :)
- Now you can Manage display of the field in the form. For example, you can now add placeholder text!
- Test the new field. Your placeholder text disappears as soon as the user starts adding content.
- As soon as you submit, the form will get validated. In the case of the email field, it will run a check if the content is formatted correctly and give an error on the screen. Even the new errors look pretty snazzy.
Getting the most out of your data with Schema.org and RESTful web services
Site builders in Drupal 8 should be thinking more about how the structured content types they create will produce data that can be used and reused in many ways, and how it will appear in search engine results or how it might be used by other applications. Drupal 8 provides two new key tools.
1. RESTful web services for site builders [#1975444] In Drupal 7, getting Drupal to output something other than HTML was quite difficult. Now Drupal can be used as a method for processing data which can be reused by more than just browsers. This will open up potential for builders to more easily integrate with other systems and applications. For Site builders it's going to be important to consider from the start the potential for the data they model to be used and reused in other ways than just through their site and browsers.
2. Schema.org integration for site builders [#2034127] Drupal 8 provides Schema.org RDF mappings for the default content types, articles and pages. For example, this provides search engines with meta data indicating which text is the "author" of an article and what is the "date" and what is a "comment". This will greatly improve search engine results and the use and re-use of data.
Right now there is no UI for adding new RDF mappings for your own custom content types. You could however copy the core mappings for the article content type rdf.mapping.node.article.yml and create your own for your own content type, such as rdf.mapping.node.restaurant.yml
Schema.org provides clear descriptions of each of the attributes for many things, including Restaurant http://schema.org/Restaurant for example. In fact it might make sense as one of the first steps of content modeling in Drupal, go check Schema.org first.
If you'd like to know more about the State of schema.org in Drupal 8, please read this by my colleague, scor, Stephane Corlosquet https://groups.drupal.org/node/309513
In my upcoming blog posts we’ll continue to dig into Site building in Drupal 8. I'll be taking a closer look at images.
Is there something else you'd like to see? I'm curious what questions you have. Please do comment below, I'd love to hear from you.
Sign up to a live Drupal 8 Site Building tutorial
You can sign up to a Live online Drupal 8 site building tutorial on Drupal 8. It will even suit beginners who are new to Drupal. We'll look at content types, WYSIWYG configuration, Image handling, Views, Display modes, Blocks, the comment form and the contact form.
Sign up to Drupal 8 Preview for Site Builders , Oct 23rd 1:00 PM EDT
See you then!
Please also check out the Drupal Training events calendar